WIN32API Registration and creation of global window classes

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.