To Establish Control of the Windows SDK Programming
I. Overview
Control is a child window, they are already defined window class, so there is no need to register, do not need to write the message processing function.
WM_CREATE message in the main window, create a child window can be.
Second, the instance
/ / Parameters: window handle, message, message parameters, message parameters
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
/ / Handle messages of interest switch (message)
{
case WM_CREATE:
CreateWindow (TEXT ("BUTTON"), / / ??control class name "
TEXT ("& button (A)"),
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 10, 10, 100, 100, hwnd, (HMENU) 1000,
/ / ??control ID
((LPCREATESTRUCT) lParam) -> hInstance, / / ??instance handle
NULL);
return 0;
case WM_DESTROY:
/ / When the user closes the window, the window is destroyed, the end of the need,
send exit message to exit the message loop PostQuitMessage (0);
return 0;
}
/ / Other messages to the default processing functions provided by the return ::
DefWindowProc (hwnd, message, wParam, lParam);
}
typedef struct tagCREATESTRUCT {
LPVOID lpCreateParams;
HINSTANCE hInstance; / / instance handle HMENU hMenu;
The HWND hwndParent;
int cy;
int cx;
int y;
int x;
LONG style;
The LPCTSTR lpszName;
LPCTSTR lpszClass;
DWORD dwExStyle is;
} CREATESTRUCT, * LPCREATESTRUCT;
Fourth, control and collaboration of the parent windowThird, on the WM_CREATE message
The WM_CREATE lParam parameter will be passed into a set-up information structure pointer (LPCREATESTRUCT). The structure contains some useful information (when the window to create a parameter).

