#include #include #pragma comment(lib, "user32.lib") LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); int main() { WNDCLASSEX wnd; SecureZeroMemory(&wnd, sizeof(WNDCLASSEX)); wnd.cbSize = sizeof(WNDCLASSEX); wnd.style = CS_VREDRAW | CS_HREDRAW; wnd.lpfnWndProc = WndProc; wnd.hInstance = GetModuleHandle(NULL); wnd.lpszClassName = "Thing"; wnd.hbrBackground = (HBRUSH) COLOR_BACKGROUND+1; RegisterClassEx(&wnd); HWND hwnd = CreateWindow("Thing", "Thing", WS_OVERLAPPEDWINDOW, 50, 50, 800, 600, 0, 0, wnd.hInstance, 0); ShowWindow(hwnd, SW_SHOW); MSG msg; while(GetMessage(&msg, 0, 0, 0)) { if(msg.message == WM_QUIT) break; TranslateMessage(&msg); DispatchMessage(&msg); } return 0; } LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { switch(uMsg) { case WM_CLOSE: { PostQuitMessage(0); return 0; } default: { return DefWindowProc(hWnd, uMsg, wParam, lParam); } } }