Untitled
unknown
plain_text
4 years ago
1.1 kB
8
Indexable
#include <windows.h>
class Widget
{
LRESULT CALLBACK Procedure(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
}
return DefWindowProcW(hwnd, msg, wParam, lParam);
}
public:
Widget()
{
WNDCLASSEXW wc = {0};
wc.cbSize = sizeof(WNDCLASSEXW);
wc.lpszClassName = L"Widget";
wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
wc.lpfnWndProc = Procedure;
wc.hCursor = LoadCursor(0, IDC_ARROW);
RegisterClassExW(&wc);
CreateWindowExW(NULL, wc.lpszClassName, L"Windows",
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
0,0, 640, 360, NULL, NULL, NULL, NULL);
}
};
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
PWSTR lpCmdLine, int nCmdShow) {
MSG msg;
Widget widget;
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int) msg.wParam;
}
Editor is loading...