Win32APIRegistering the Global window class
- Registration of the Application Global window class
- typedef struct TAGWNDCLASSEX {
- UINT cbsize;// the size of the structure, with sizeof come to
- UINT style;// window class style, default settings left and right draw
- WNDPROC Lpfnwndproc;// callback functions, window handlers, people working.
- int Cbclsextra;// additional data for window classes Buff the size
- int Cbwndextra;// additional data for Windows Buff the size
- hinstance hinstance;// instance handle of the current module
- hicon Hicon;// window icon handle
- hcursor hcursor;// the handle of the mouse
- hbrush hbrbackground;// Paint handle for drawing window background
- LPCTSTR lpszmenuname;// Resources for window menus ID string
- LPCTSTR lpszclassname;// Name of the window class
- hicon HICONSM;// Small icon handle for window
- } wndclassex, *pwndclassex;
- Global window class registration, to add in style Cs_globalclass , the local window class does not add this style parameter
For example: wndclassex Wcex = {0}; wcex.stle = ... | Cs_globalclass;
Win32API CreateWindow
- HWND CreateWindowEx (DWORD dwexstyle,//the extended style of the window LPCTSTR Lpclassname,//registered window class name LPCTSTR Lpwindowname,//window title bar name DWORD dwstyle,//the basic style of the window int x,//the horizontal coordinate position of the upper left corner of the window int y,//vertical coordinate position of the upper left corner of the window int nwidth,//width of window int nheight,//Height of window HWND hwndparent,//the parent window handle of the window HMENU HMENU,//Window menu handle hinstance hinstance,//Application Instance handle lpvoid Lpparam//Additional parameters when window creation );
- Creating a child window
- To set the parent window handle when creating
- Create style to add ws_child| Ws_visible
Win32API Create a Lookup procedure for a window class
- 1 according to the incomingClassName, in"Local"window class to find,
- Find Execution 2 ,
- execution not found 3 .
- 2 Compare"Local"the window class is created with an incoming"HInstancevariables"
- Equality means: Create and register a window class in the same module (created by the same process), create a window and return.
- unequal means: Created and registered window classes are not in the same module (different processes created), continue to execute 3 .
- 3 Find in the " global " window class
- Find Execution 4.
- execution not found 5.
- 4 Use the found window class information to create a window to return.
- 5 finding in the system window class
- Locate the Create window to return.
- Failed to create window if not found.
WIN32API Registration and creation of global window classes