Skip to content

Instantly share code, notes, and snippets.

@astrcomp
Created August 8, 2016 10:53
Show Gist options
  • Save astrcomp/8ebd426a3d01c51b38fee40a65ed968a to your computer and use it in GitHub Desktop.
Save astrcomp/8ebd426a3d01c51b38fee40a65ed968a to your computer and use it in GitHub Desktop.
#include <windows.h>
LONG WINAPI WndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASS w = { CS_HREDRAW | CS_VREDRAW ,WndProc ,0,0,hInstance,NULL,NULL,(HBRUSH)GetStockObject(WHITE_BRUSH),NULL,L"Window Class" };
RegisterClass(&w);
HWND hwnd = CreateWindow(L"Window Class", L"Заголовок", WS_OVERLAPPEDWINDOW, 300, 200, 200, 180, NULL, NULL, hInstance, NULL);
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LONG WINAPI WndProc(HWND hwnd, UINT Message, WPARAM wparam, LPARAM lparam)
{
switch (Message) {
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, Message, wparam, lparam);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment