source: Daodan/src/guitest.c@ 990

Last change on this file since 990 was 990, checked in by alloc, 11 years ago

Daodan 3.7:

File size: 1.0 KB
Line 
1#include <windows.h>
2
3LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
4
5guitest(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
37LRESULT 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}
Note: See TracBrowser for help on using the repository browser.