Created
June 4, 2013 18:21
-
-
Save gszauer/5708223 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define WIN32_LEAN_AND_MEAN | |
#define WIN32_EXTRA_LEAN | |
#include <windows.h> | |
HWND hwnd; | |
HINSTANCE hinstance; | |
LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam); | |
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { | |
hinstance = hInstance; | |
WNDCLASS wndclass; | |
wndclass.style = CS_HREDRAW | CS_VREDRAW; | |
wndclass.lpfnWndProc = WndProc; | |
wndclass.cbClsExtra = 0; | |
wndclass.cbWndExtra = 0; | |
wndclass.hInstance = hInstance; | |
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION); | |
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); | |
wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); | |
wndclass.lpszMenuName = 0; | |
wndclass.lpszClassName = "WinMin"; | |
RegisterClass(&wndclass); | |
hwnd = CreateWindow("WinMin", "Minimal Window", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 600, 400, NULL, NULL, hInstance, szCmdLine); | |
MSG msg; | |
while (GetMessage(&msg, NULL, 0, 0)) { | |
TranslateMessage(&msg); | |
DispatchMessage(&msg); | |
} | |
return (int)msg.wParam; | |
} | |
LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) { | |
switch (iMsg) { | |
case WM_CREATE : | |
break; | |
case WM_CLOSE : | |
DestroyWindow(hwnd); | |
break; | |
case WM_DESTROY : | |
PostQuitMessage(0); | |
break; | |
} | |
return DefWindowProc(hwnd, iMsg, wParam, lParam); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment