Home > Software engineering >  Want to register two window class, but the first registration is not successful, or put it in the fo
Want to register two window class, but the first registration is not successful, or put it in the fo

Time:12-27

WNDCLASSEXW wc.
The static TCHAR szchildName []=TEXT (" ChildWindow ");
Wc. CbSize=sizeof (long);
Wc. Style=CS_HREDRAW | CS_VREDRAW;
Wc. LpfnWndProc=AboutWndChildProc;
Wc. CbClsExtra=0;
Wc. CbWndExtra=0;
The wc. The hInstance=GetMyModuleHandle ();
Wc. HIcon=NULL;
Wc. HCursor=LoadCursor (NULL, IDC_ARROW);
Wc. HbrBackground=(HBRUSH) (BLACK_BRUSH);
Wc. LpszMenuName=NULL;
Wc. LpszClassName=szchildName;
Wc. HIconSm=LoadIcon (NULL, IDI_APPLICATION);
If (RegisterClassEx (& amp; Wc)==0)
{
MessageBox (NULL, TEXT (" ABC1 "), TEXT (" ABC "), MB_OK);
Return FALSE;
}
RegisterClassEx (& amp; Wc);

WNDCLASSEXW wcex;
The HWND HWND;
MSG MSG.
If (! GetClassInfoEx (GetMyModuleHandle (), TEXT (UI_CLASS_ABOUTWINDOW), & amp; Wcex))
{
Wcex. CbSize=sizeof (modifed WNDCLASSEX);
Wcex. Style=CS_HREDRAW | CS_VREDRAW;
Wcex. LpfnWndProc=AboutWndProc;
Wcex. CbClsExtra=0;
Wcex. CbWndExtra=0;
Wcex. HInstance=GetMyModuleHandle ();
Wcex. HIcon=LoadIcon (NULL, IDI_APPLICATION);
Wcex. HCursor=LoadCursor (NULL, IDC_ARROW);
Wcex. HbrBackground=(HBRUSH) (COLOR_WINDOW);
Wcex. LpszMenuName=NULL;
Wcex. LpszClassName=TEXT (UI_CLASS_ABOUTWINDOW);
Wcex. HIconSm=LoadIcon (NULL, IDI_APPLICATION);

If (RegisterClassEx (& amp; Wcex)==0)
{
MessageBox (NULL, TEXT (" ABC "), TEXT (" ABC "), MB_OK);
Return FALSE;
}
}

RegisterClassEx (& amp; Wcex);

CodePudding user response:

Such instructions are included in the modifed WNDCLASSEX Structure parameter
CbSize
Specifies the size, in bytes, of this structure. Set this member to sizeof (modifed WNDCLASSEX). Be sure to Set this member before calling the GetClassInfoEx function.


CodePudding user response:

Thank you for your reply, to amend the good
  • Related