對於WNDCLASSEX的定義見WINUSER.H。可以看出為了使用不同的
字元集,定義了兩個
結構體。
後面有一個宏,會根據編譯選項來決定使用哪個結構。
typedefstructtagWNDCLASSA{UINTstyle;WNDPROClpfnWndProc;intcbClsExtra;intcbWndExtra;HINSTANCEhInstance;HICONhIcon;HCURSORhCursor;HBRUSHhbrBackground;LPCSTRlpszMenuName;LPCSTRlpszClassName;}WNDCLASSA,*PWNDCLASSA,NEAR*NPWNDCLASSA,FAR*LPWNDCLASSA;typedefstructtagWNDCLASSW{UINTstyle;WNDPROClpfnWndProc;intcbClsExtra;intcbWndExtra;HINSTANCEhInstance;HICONhIcon;HCURSORhCursor;HBRUSHhbrBackground;LPCWSTRlpszMenuName;LPCWSTRlpszClassName;}WNDCLASSW,*PWNDCLASSW,NEAR*NPWNDCLASSW,FAR*LPWNDCLASSW;#ifdefUNICODEtypedefWNDCLASSWWNDCLASS;typedefPWNDCLASSWPWNDCLASS;typedefNPWNDCLASSWNPWNDCLASS;typedefLPWNDCLASSWLPWNDCLASS;#else//UNICODEtypedefWNDCLASSAWNDCLASS;typedefPWNDCLASSAPWNDCLASS;typedefNPWNDCLASSANPWNDCLASS;typedefLPWNDCLASSALPWNDCLASS;#endif