Skip to content

Instantly share code, notes, and snippets.

@kuzemkon
Created December 8, 2014 20:08
Show Gist options
  • Select an option

  • Save kuzemkon/a461de05e3ccb5a5391a to your computer and use it in GitHub Desktop.

Select an option

Save kuzemkon/a461de05e3ccb5a5391a to your computer and use it in GitHub Desktop.
#include <Windows.h>
#define width 640
#define height 480
LRESULT CALLBACK WindowProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX windowClass;
HWND hWnd;
MSG uMsg;
memset(&windowClass, 0, sizeof(WNDCLASSEX));
windowClass.cbSize = sizeof(WNDCLASSEX);
windowClass.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
windowClass.hInstance = hInstance;
windowClass.lpfnWndProc = WindowProc;
windowClass.lpszClassName = "Kramer";
RegisterClassEx(&windowClass);
hWnd = CreateWindow(windowClass.lpszClassName, "Kramer method", WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
(GetSystemMetrics(SM_CXSCREEN) - width) / 2, (GetSystemMetrics(SM_CYSCREEN) - height) / 2, width, height, NULL, NULL, NULL, NULL);
ShowWindow(hWnd, nCmdShow);
while (GetMessage(&uMsg, hWnd, NULL, NULL))
{
TranslateMessage(&uMsg);
DispatchMessage(&uMsg);
}
return uMsg.wParam;
}
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_CLOSE:
ExitProcess(0);
break;
default:
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment