you need
  • - compiler;
  • - Windows Platform SDK.
Register the window class that is to be created, if necessary.Make the call API-functions RegisterClass, RegisterClassEx or use the appropriate functionality applied framework.

RegisterClass function and RegisterClassEx take as its only parameter a pointer to the structure type and WNDCLASS WNDCLASSEX respectively.The return value of type ATOM can be used instead of the class name when creating a window.If the function fails, the return value is 0.

Create an instance of the type of structure or WNDCLASS WNDCLASSEX.Fill all necessary fields.In particular, the correct values ​​must be placed in:

- cbSize - the size of the structure in bytes;
- style - style set the window class;
- lpfnWndProc - a pointer to the window procedure;
- hInstance handle module, which registered window class;
- lpszClassName - symbolic name of the class.

The remaining fields can be recorded values ​​NULL.Make the call to the function to register the window class.Check the returned result.
Select an existing window class, if necessary.You should be aware of the symbolic name of the class (the one that is transmitted through the pointer lpszClassName during registration) or the corresponding value of type ATOM.The class may be local at the application level, the global application level (registration is made with a flag CS_GLOBALCLASS) or systemic.For the latter type are window classes with names: Button, ComboBox, Edit, ListBox, MDIClient, ScrollBar, Static.Classes like RichEdit20W or SysListView32, recorded when loading the corresponding libraries.
create window Windows.Please use the API-functions CreateWindow, CreateWindowEx or appropriate methods wrapper object classes used by the framework or library.A prototype of CreateWindowEx function as follows:

HWND CreateWindowEx (
DWORD dwExStyle,
LPCTSTR lpClassName,
LPCTSTR lpWindowName,
DWORD dwStyle,
int x,
int y,
int nWidth,
int nHeight,
HWND hWndParent,
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam

CreateWindow function differs from a lack of parameter CreateWindowEx dwExStyle.

Make a call CreateWindow or CreateWindowEx.Passed as a parameter lpClassName name or type value ATOM window class defined in the first or second step.The parameters x, y, nWidth, nHeight may be the position and the size of the window being created.The window handle of the parent (if any) is transmitted through hWndParent.

save and analyze the value returned from the CreateWindow or CreateWindowEx.If successful, they will return a handle to the new window, the failure - NULL.