The following example creates a header control and positions it along the top of the parent window's client area. The control is initially hidden. The example uses the HDM_LAYOUT message to determine the appropriate size and position of the control given the bounding rectangle of the parent window. Then the example sets the size and position of the control and makes it visible.

// DoCreateHeader - creates a header control that is positioned along

// the top of the parent window's client area.

// Returns the handle of the header control.

// hwndParent - handle of the parent window

//

// Global variable

// g_hinst - handle of the application instance

extern HINSTANCE g_hinst;

HWND DoCreateHeader(HWND hwndParent)

{

HWND hwndHeader;

RECT rcParent;

HD_LAYOUT hdl;

WINDOWPOS wp;

// Ensure that the common control DLL is loaded, and then create

// the header control.

InitCommonControls();

if ((hwndHeader = CreateWindowEx(0, WC_HEADER, (LPCTSTR) NULL,

WS_CHILD | WS_BORDER | HDS_BUTTONS | HDS_HORZ,

0, 0, 0, 0, hwndParent, (HMENU) ID_HEADER, g_hinst,

(LPVOID) NULL)) == NULL)

return (HWND) NULL;

// Retrieve the bounding rectangle of the parent window's

// client area, and then request size and position values

// from the header control.

GetClientRect(hwndParent, &rcParent);

hdl.prc = &rcParent;

hdl.pwpos = ℘

if (!SendMessage(hwndHeader, HDM_LAYOUT, 0, (LPARAM) &hdl))

return (HWND) NULL;

// Set the size, position, and visibility of the header control.

SetWindowPos(hwndHeader, wp.hwndInsertAfter, wp.x, wp.y,

wp.cx, wp.cy, wp.flags | SWP_SHOWWINDOW);

return hwndHeader;

}

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database