1 | #include <windows.h>
|
---|
2 |
|
---|
3 | LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
---|
4 |
|
---|
5 | guitest(HMODULE hInstance, int nCmdShow)
|
---|
6 | {
|
---|
7 | MSG msg;
|
---|
8 | HWND hwnd;
|
---|
9 | WNDCLASSW wc;
|
---|
10 |
|
---|
11 | wc.style = CS_HREDRAW | CS_VREDRAW;
|
---|
12 | wc.cbClsExtra = 0;
|
---|
13 | wc.cbWndExtra = 0;
|
---|
14 | wc.lpszClassName = L"Window";
|
---|
15 | wc.hInstance = hInstance;
|
---|
16 | wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
|
---|
17 | wc.lpszMenuName = NULL;
|
---|
18 | wc.lpfnWndProc = WndProc;
|
---|
19 | wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
---|
20 | wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
---|
21 |
|
---|
22 | RegisterClassW(&wc);
|
---|
23 | hwnd = CreateWindowW( wc.lpszClassName, L"Window",
|
---|
24 | WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
---|
25 | 100, 100, 350, 250, NULL, NULL, hInstance, NULL);
|
---|
26 |
|
---|
27 | ShowWindow(hwnd, nCmdShow);
|
---|
28 | UpdateWindow(hwnd);
|
---|
29 |
|
---|
30 | while( GetMessage(&msg, NULL, 0, 0)) {
|
---|
31 | DispatchMessage(&msg);
|
---|
32 | }
|
---|
33 |
|
---|
34 | return (int) msg.wParam;
|
---|
35 | }
|
---|
36 |
|
---|
37 | LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
---|
38 | {
|
---|
39 | switch(msg)
|
---|
40 | {
|
---|
41 | case WM_DESTROY:
|
---|
42 | PostQuitMessage(0);
|
---|
43 | return 0;
|
---|
44 | }
|
---|
45 |
|
---|
46 | return DefWindowProcW(hwnd, msg, wParam, lParam);
|
---|
47 | }
|
---|