#include #include #include #include void MessageLoop(MSG*, HWND) int main(void){ MSG msg; HWND hwnd; WNDCLASS wndclass; HINSTANCE hInst = GetCurrentProcess(); wndclass.style = CS_VREDRAW | CS_HREDRAW; wndclass.lpfnWndProc = &DefWindowProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = hInst; wndclass.hIcon = NULL; wndclass.hCursor = GetCursor(); wndclass.hbrBackground = GetSysColorBrush(0); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = "Sample window"; RegisterClass(&wndclass); hwnd = CreateWindow( "Sample window", "Sample", WS_OVERLAPPEDWINDOW, 35, 35, 765, 505, NULL, NULL, hInst, NULL ); ShowWindow(hwnd,SW_SHOWDEFAULT); MessageLoop(&msg,hwnd); UnregisterClass("Sample window", hInst); } void MessageLoop(MSG* msg, HWND hwnd){ while(GetMessage(msg, hwnd, 0, 0) > 0)){ TranslateMessage(msg); DispatchMessage(msg); } }