CreateWnd();
//The message loop
MSG msg;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
如果我们创建一个线程,然后在这个线程中创建窗口,看看带给我们的是什么:
#include \"windows.h\"
HWND g_hWnd = NULL;
HINSTANCE g_hInst;
LRESULT WndProc(HWND hWnd,UINT wMsg,WPARAM wParam,LPARAM lParam)
{
return DefWindowProc(hWnd,wMsg,wParam,lParam);
}
void CreateWnd(void)
{
WNDCLASS wc = {0};
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = g_hInst;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_WINDOW);
wc.lpszMenuName = NULL;
wc.lpszClassName = TEXT(\"SimpleWindow\");
RegisterClass(&wc);
g_hWnd = CreateWindowEx(0, [Page]
TEXT(\"SimpleWindow\"),
TEXT(\"SimpleWindow\"),
WS_VISIBLE,
0,
0,
200,
200,
NULL,
NULL,