1 /* Unit tests for treeview.
3 * Copyright 2005 Krzysztof Foltman
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #include "resources.h"
33 #include "wine/test.h"
37 static void MakeButton(TBBUTTON *p, int idCommand, int fsStyle, int nString) {
39 p->idCommand = idCommand;
40 p->fsState = TBSTATE_ENABLED;
45 static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
47 return DefWindowProcA(hWnd, msg, wParam, lParam);
50 static void basic_test(void)
56 MakeButton(buttons+i, 1000+i, TBSTYLE_CHECKGROUP, 0);
57 MakeButton(buttons+3, 1003, TBSTYLE_SEP|TBSTYLE_GROUP, 0);
58 MakeButton(buttons+6, 1006, TBSTYLE_SEP, 0);
60 hToolbar = CreateToolbarEx(hMainWnd,
61 WS_VISIBLE | WS_CLIPCHILDREN | CCS_TOP |
62 WS_CHILD | TBSTYLE_LIST,
65 buttons, sizeof(buttons)/sizeof(buttons[0]),
66 0, 0, 20, 16, sizeof(TBBUTTON));
67 ok(hToolbar != NULL, "Toolbar creation\n");
68 SendMessage(hToolbar, TB_ADDSTRINGA, 0, (LPARAM)"test\000");
70 /* test for exclusion working inside a separator-separated :-) group */
71 SendMessage(hToolbar, TB_CHECKBUTTON, 1000, 1); /* press A1 */
72 ok(SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1000, 0), "A1 pressed\n");
73 ok(!SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1001, 0), "A2 not pressed\n");
75 SendMessage(hToolbar, TB_CHECKBUTTON, 1004, 1); /* press A5, release A1 */
76 ok(SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1004, 0), "A5 pressed\n");
77 ok(!SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1000, 0), "A1 not pressed anymore\n");
79 SendMessage(hToolbar, TB_CHECKBUTTON, 1005, 1); /* press A6, release A5 */
80 ok(SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1005, 0), "A6 pressed\n");
81 ok(!SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1004, 0), "A5 not pressed anymore\n");
83 /* test for inter-group crosstalk, ie. two radio groups interfering with each other */
84 SendMessage(hToolbar, TB_CHECKBUTTON, 1007, 1); /* press B2 */
85 ok(SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1005, 0), "A6 still pressed, no inter-group crosstalk\n");
86 ok(!SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1000, 0), "A1 still not pressed\n");
87 ok(SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1007, 0), "B2 pressed\n");
89 SendMessage(hToolbar, TB_CHECKBUTTON, 1000, 1); /* press A1 and ensure B group didn't suffer */
90 ok(!SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1005, 0), "A6 not pressed anymore\n");
91 ok(SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1000, 0), "A1 pressed\n");
92 ok(SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1007, 0), "B2 still pressed\n");
94 SendMessage(hToolbar, TB_CHECKBUTTON, 1008, 1); /* press B3, and ensure A group didn't suffer */
95 ok(!SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1005, 0), "A6 pressed\n");
96 ok(SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1000, 0), "A1 pressed\n");
97 ok(!SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1007, 0), "B2 not pressed\n");
98 ok(SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1008, 0), "B3 pressed\n");
99 DestroyWindow(hToolbar);
102 static void rebuild_toolbar(HWND *hToolbar)
104 if (*hToolbar != NULL)
105 DestroyWindow(*hToolbar);
106 *hToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0,
107 hMainWnd, (HMENU)5, GetModuleHandle(NULL), NULL);
108 ok(*hToolbar != NULL, "Toolbar creation problem\n");
109 ok(SendMessage(*hToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0) == 0, "TB_BUTTONSTRUCTSIZE failed\n");
110 ok(SendMessage(*hToolbar, TB_AUTOSIZE, 0, 0) == 0, "TB_AUTOSIZE failed\n");
113 #define CHECK_IMAGELIST(count, dx, dy) { \
115 HIMAGELIST himl = (HIMAGELIST)SendMessageA(hToolbar, TB_GETIMAGELIST, 0, 0); \
116 ok(himl != NULL, "No image list\n"); \
118 ok(ImageList_GetImageCount(himl) == count, "Images count mismatch - %d vs %d\n", count, ImageList_GetImageCount(himl)); \
119 ImageList_GetIconSize(himl, &cx, &cy); \
120 ok(cx == dx && cy == cy, "Icon size mismatch - %dx%d vs %dx%d\n", dx, dy, cx, cy); \
124 #define CHECK_IMAGELIST_TODO_COUNT(count, dx, dy) { \
126 HIMAGELIST himl = (HIMAGELIST)SendMessageA(hToolbar, TB_GETIMAGELIST, 0, 0); \
127 ok(himl != NULL, "No image list\n"); \
129 todo_wine ok(ImageList_GetImageCount(himl) == count, "Images count mismatch - %d vs %d\n", count, ImageList_GetImageCount(himl)); \
130 ImageList_GetIconSize(himl, &cx, &cy); \
131 ok(cx == dx && cy == cy, "Icon size mismatch - %dx%d vs %dx%d\n", dx, dy, cx, cy); \
135 #define CHECK_IMAGELIST_TODO_COUNT_SIZE(count, dx, dy) { \
137 HIMAGELIST himl = (HIMAGELIST)SendMessageA(hToolbar, TB_GETIMAGELIST, 0, 0); \
138 ok(himl != NULL, "No image list\n"); \
140 todo_wine ok(ImageList_GetImageCount(himl) == count, "Images count mismatch - %d vs %d\n", count, ImageList_GetImageCount(himl)); \
141 ImageList_GetIconSize(himl, &cx, &cy); \
142 todo_wine ok(cx == dx && cy == cy, "Icon size mismatch - %dx%d vs %dx%d\n", dx, dy, cx, cy); \
146 static void test_add_bitmap(void)
148 HWND hToolbar = NULL;
151 TBADDBITMAP stdsmall;
156 /* empty 128x15 bitmap */
157 bmp128.hInst = GetModuleHandle(NULL);
158 bmp128.nID = IDB_BITMAP_128x15;
160 /* empty 80x15 bitmap */
161 bmp80.hInst = GetModuleHandle(NULL);
162 bmp80.nID = IDB_BITMAP_80x15;
164 /* standard bitmap - 240x15 pixels */
165 stdsmall.hInst = HINST_COMMCTRL;
166 stdsmall.nID = IDB_STD_SMALL_COLOR;
168 rebuild_toolbar(&hToolbar);
169 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 8, (LPARAM)&bmp128) == 0, "TB_ADDBITMAP - unexpected return\n");
170 CHECK_IMAGELIST(8, 16, 15);
172 /* adding more bitmaps */
173 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 5, (LPARAM)&bmp80) == 8, "TB_ADDBITMAP - unexpected return\n");
174 CHECK_IMAGELIST(13, 16, 15);
175 /* adding the same bitmap will simply return the index of the already loaded block */
176 ret = SendMessageA(hToolbar, TB_ADDBITMAP, 8, (LPARAM)&bmp128);
177 ok(ret == 0, "TB_ADDBITMAP - unexpected return %d\n", ret);
178 CHECK_IMAGELIST(13, 16, 15);
179 ret = SendMessageA(hToolbar, TB_ADDBITMAP, 5, (LPARAM)&bmp80);
180 ok(ret == 8, "TB_ADDBITMAP - unexpected return %d\n", ret);
181 CHECK_IMAGELIST(13, 16, 15);
182 /* even if we increase the wParam */
183 ret = SendMessageA(hToolbar, TB_ADDBITMAP, 55, (LPARAM)&bmp80);
184 ok(ret == 8, "TB_ADDBITMAP - unexpected return %d\n", ret);
185 CHECK_IMAGELIST(13, 16, 15);
187 /* when the wParam is smaller than the bitmaps count but non-zero, all the bitmaps will be added*/
188 rebuild_toolbar(&hToolbar);
189 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 3, (LPARAM)&bmp128) == 0, "TB_ADDBITMAP - unexpected return\n");
190 CHECK_IMAGELIST(8, 16, 15);
191 ret = SendMessageA(hToolbar, TB_ADDBITMAP, 5, (LPARAM)&bmp80);
192 ok(ret == 3, "TB_ADDBITMAP - unexpected return %d\n", ret);
193 /* the returned value is misleading - id 8 is the id of the first icon from bmp80 */
194 CHECK_IMAGELIST(13, 16, 15);
196 /* the same for negative wParam */
197 rebuild_toolbar(&hToolbar);
198 ret = SendMessageA(hToolbar, TB_ADDBITMAP, -143, (LPARAM)&bmp128);
199 ok(ret == 0, "TB_ADDBITMAP - unexpected return %d\n", ret);
200 CHECK_IMAGELIST(8, 16, 15);
201 ret = SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&bmp80);
202 ok(ret == -143, "TB_ADDBITMAP - unexpected return %d\n", ret);
203 CHECK_IMAGELIST(13, 16, 15);
205 /* for zero only one bitmap will be added */
206 rebuild_toolbar(&hToolbar);
207 ret = SendMessageA(hToolbar, TB_ADDBITMAP, 0, (LPARAM)&bmp80);
208 ok(ret == 0, "TB_ADDBITMAP - unexpected return %d\n", ret);
209 CHECK_IMAGELIST(1, 16, 15);
211 /* if wParam is larger than the amount of icons, the list is grown */
212 rebuild_toolbar(&hToolbar);
213 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 100, (LPARAM)&bmp80) == 0, "TB_ADDBITMAP - unexpected return\n");
214 CHECK_IMAGELIST(100, 16, 15);
215 ret = SendMessageA(hToolbar, TB_ADDBITMAP, 100, (LPARAM)&bmp128);
216 ok(ret == 100, "TB_ADDBITMAP - unexpected return %d\n", ret);
217 CHECK_IMAGELIST(200, 16, 15);
219 /* adding built-in items - the wParam is ignored */
220 rebuild_toolbar(&hToolbar);
221 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 5, (LPARAM)&bmp80) == 0, "TB_ADDBITMAP - unexpected return\n");
222 CHECK_IMAGELIST(5, 16, 15);
223 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 0, (LPARAM)&stdsmall) == 5, "TB_ADDBITMAP - unexpected return\n");
224 CHECK_IMAGELIST(20, 16, 15);
225 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 5, (LPARAM)&bmp128) == 20, "TB_ADDBITMAP - unexpected return\n");
226 CHECK_IMAGELIST(28, 16, 15);
228 /* when we increase the bitmap size, less icons will be created */
229 rebuild_toolbar(&hToolbar);
230 ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(20, 20)) == TRUE, "TB_SETBITMAPSIZE failed\n");
231 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&bmp128) == 0, "TB_ADDBITMAP - unexpected return\n");
232 CHECK_IMAGELIST(6, 20, 20);
233 ret = SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&bmp80);
234 ok(ret == 1, "TB_ADDBITMAP - unexpected return %d\n", ret);
235 CHECK_IMAGELIST(10, 20, 20);
236 /* the icons can be resized - an UpdateWindow is needed as this probably happens during WM_PAINT */
237 ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(8, 8)) == TRUE, "TB_SETBITMAPSIZE failed\n");
238 UpdateWindow(hToolbar);
239 CHECK_IMAGELIST(26, 8, 8);
240 /* loading a standard bitmaps automatically resizes the icons */
241 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&stdsmall) == 2, "TB_ADDBITMAP - unexpected return\n");
242 UpdateWindow(hToolbar);
243 CHECK_IMAGELIST(28, 16, 15);
245 /* two more SETBITMAPSIZE tests */
246 rebuild_toolbar(&hToolbar);
247 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 100, (LPARAM)&bmp128) == 0, "TB_ADDBITMAP - unexpected return\n");
248 CHECK_IMAGELIST(100, 16, 15);
249 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 100, (LPARAM)&bmp80) == 100, "TB_ADDBITMAP - unexpected return\n");
250 CHECK_IMAGELIST(200, 16, 15);
251 ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(8, 8)) == TRUE, "TB_SETBITMAPSIZE failed\n");
252 UpdateWindow(hToolbar);
253 CHECK_IMAGELIST(200, 8, 8);
254 ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(30, 30)) == TRUE, "TB_SETBITMAPSIZE failed\n");
255 UpdateWindow(hToolbar);
256 CHECK_IMAGELIST(200, 30, 30);
257 rebuild_toolbar(&hToolbar);
258 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 5, (LPARAM)&bmp128) == 0, "TB_ADDBITMAP - unexpected return\n");
259 CHECK_IMAGELIST(8, 16, 15);
260 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 3, (LPARAM)&bmp80) == 5, "TB_ADDBITMAP - unexpected return\n");
261 CHECK_IMAGELIST(13, 16, 15);
262 ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(30, 30)) == TRUE, "TB_SETBITMAPSIZE failed\n");
263 UpdateWindow(hToolbar);
264 CHECK_IMAGELIST(8, 30, 30);
266 /* the control can add bitmaps to an existing image list */
267 rebuild_toolbar(&hToolbar);
268 himl = ImageList_LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BITMAP_80x15), 20, 2, CLR_NONE, IMAGE_BITMAP, LR_DEFAULTCOLOR);
269 ok(himl != NULL, "failed to create imagelist\n");
270 ok(SendMessageA(hToolbar, TB_SETIMAGELIST, 0, (LPARAM)himl) == 0, "TB_SETIMAGELIST failed\n");
271 CHECK_IMAGELIST(4, 20, 15);
272 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&bmp128) == 0, "TB_ADDBITMAP - unexpected return\n");
273 CHECK_IMAGELIST(10, 20, 15);
274 /* however TB_SETBITMAPSIZE/add std bitmap won't change the image size (the button size does change!) */
275 ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(8, 8)) == TRUE, "TB_SETBITMAPSIZE failed\n");
276 UpdateWindow(hToolbar);
277 CHECK_IMAGELIST(10, 20, 15);
278 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 0, (LPARAM)&stdsmall) == 1, "TB_SETBITMAPSIZE failed\n");
279 UpdateWindow(hToolbar);
280 CHECK_IMAGELIST_TODO_COUNT(22, 20, 15);
282 /* check standard bitmaps */
283 addbmp.hInst = HINST_COMMCTRL;
284 addbmp.nID = IDB_STD_SMALL_COLOR;
285 rebuild_toolbar(&hToolbar);
286 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&addbmp) == 0, "TB_ADDBITMAP - unexpected return\n");
287 CHECK_IMAGELIST(15, 16, 15);
288 addbmp.nID = IDB_STD_LARGE_COLOR;
289 rebuild_toolbar(&hToolbar);
290 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&addbmp) == 0, "TB_ADDBITMAP - unexpected return\n");
291 CHECK_IMAGELIST(15, 24, 24);
293 addbmp.nID = IDB_VIEW_SMALL_COLOR;
294 rebuild_toolbar(&hToolbar);
295 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&addbmp) == 0, "TB_ADDBITMAP - unexpected return\n");
296 CHECK_IMAGELIST(12, 16, 15);
297 addbmp.nID = IDB_VIEW_LARGE_COLOR;
298 rebuild_toolbar(&hToolbar);
299 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&addbmp) == 0, "TB_ADDBITMAP - unexpected return\n");
300 CHECK_IMAGELIST(12, 24, 24);
302 addbmp.nID = IDB_HIST_SMALL_COLOR;
303 rebuild_toolbar(&hToolbar);
304 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&addbmp) == 0, "TB_ADDBITMAP - unexpected return\n");
305 CHECK_IMAGELIST(5, 16, 15);
306 addbmp.nID = IDB_HIST_LARGE_COLOR;
307 rebuild_toolbar(&hToolbar);
308 ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&addbmp) == 0, "TB_ADDBITMAP - unexpected return\n");
309 CHECK_IMAGELIST(5, 24, 24);
312 DestroyWindow(hToolbar);
315 #define CHECK_STRING_TABLE(count, tab) { \
318 for (_i = 0; _i < (count); _i++) {\
319 ret = SendMessageA(hToolbar, TB_GETSTRING, MAKEWPARAM(260, _i), (LPARAM)_buf); \
320 ok(ret >= 0, "TB_GETSTRING - unexpected return %d while checking string %d\n", ret, _i); \
322 ok(strcmp(_buf, (tab)[_i]) == 0, "Invalid string #%d - '%s' vs '%s'\n", _i, (tab)[_i], _buf); \
324 ok(SendMessageA(hToolbar, TB_GETSTRING, MAKEWPARAM(260, (count)), (LPARAM)_buf) == -1, \
325 "Too many string in table\n"); \
328 void test_add_string()
330 LPCSTR test1 = "a\0b\0";
331 LPCSTR test2 = "|a|b||\0";
332 LPCSTR ret1[] = {"a", "b"};
333 LPCSTR ret2[] = {"a", "b", "|a|b||"};
334 LPCSTR ret3[] = {"a", "b", "|a|b||", "p", "q"};
335 LPCSTR ret4[] = {"a", "b", "|a|b||", "p", "q", "p"};
336 LPCSTR ret5[] = {"a", "b", "|a|b||", "p", "q", "p", "p", "q"};
337 LPCSTR ret6[] = {"a", "b", "|a|b||", "p", "q", "p", "p", "q", "p", "", "q"};
338 LPCSTR ret7[] = {"a", "b", "|a|b||", "p", "q", "p", "p", "q", "p", "", "q", "br", "c", "d"};
339 HWND hToolbar = NULL;
342 rebuild_toolbar(&hToolbar);
343 ret = SendMessageA(hToolbar, TB_ADDSTRINGA, 0, (LPARAM)test1);
344 ok(ret == 0, "TB_ADDSTRINGA - unexpected return %d\n", ret);
345 CHECK_STRING_TABLE(2, ret1);
346 ret = SendMessageA(hToolbar, TB_ADDSTRINGA, 0, (LPARAM)test2);
347 ok(ret == 2, "TB_ADDSTRINGA - unexpected return %d\n", ret);
348 CHECK_STRING_TABLE(3, ret2);
350 ret = SendMessageA(hToolbar, TB_ADDSTRINGA, (WPARAM)GetModuleHandle(NULL), IDS_TBADD1);
351 ok(ret == 3, "TB_ADDSTRINGA - unexpected return %d\n", ret);
352 CHECK_STRING_TABLE(3, ret2);
353 ret = SendMessageA(hToolbar, TB_ADDSTRINGA, (WPARAM)GetModuleHandle(NULL), IDS_TBADD2);
354 ok(ret == 3, "TB_ADDSTRINGA - unexpected return %d\n", ret);
355 CHECK_STRING_TABLE(5, ret3);
356 ret = SendMessageA(hToolbar, TB_ADDSTRINGA, (WPARAM)GetModuleHandle(NULL), IDS_TBADD3);
357 ok(ret == 5, "TB_ADDSTRINGA - unexpected return %d\n", ret);
358 CHECK_STRING_TABLE(6, ret4);
359 ret = SendMessageA(hToolbar, TB_ADDSTRINGA, (WPARAM)GetModuleHandle(NULL), IDS_TBADD4);
360 ok(ret == 6, "TB_ADDSTRINGA - unexpected return %d\n", ret);
361 CHECK_STRING_TABLE(8, ret5);
362 ret = SendMessageA(hToolbar, TB_ADDSTRINGA, (WPARAM)GetModuleHandle(NULL), IDS_TBADD5);
363 ok(ret == 8, "TB_ADDSTRINGA - unexpected return %d\n", ret);
364 CHECK_STRING_TABLE(11, ret6);
365 ret = SendMessageA(hToolbar, TB_ADDSTRINGA, (WPARAM)GetModuleHandle(NULL), IDS_TBADD6);
366 ok(ret == 11, "TB_ADDSTRINGA - unexpected return %d\n", ret);
367 CHECK_STRING_TABLE(11, ret6);
368 ret = SendMessageA(hToolbar, TB_ADDSTRINGA, (WPARAM)GetModuleHandle(NULL), IDS_TBADD7);
369 ok(ret == 11, "TB_ADDSTRINGA - unexpected return %d\n", ret);
370 CHECK_STRING_TABLE(14, ret7);
379 InitCommonControls();
381 wc.style = CS_HREDRAW | CS_VREDRAW;
384 wc.hInstance = GetModuleHandleA(NULL);
386 wc.hCursor = LoadCursorA(NULL, MAKEINTRESOURCEA(IDC_IBEAM));
387 wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
388 wc.lpszMenuName = NULL;
389 wc.lpszClassName = "MyTestWnd";
390 wc.lpfnWndProc = MyWndProc;
393 hMainWnd = CreateWindowExA(0, "MyTestWnd", "Blah", WS_OVERLAPPEDWINDOW,
394 CW_USEDEFAULT, CW_USEDEFAULT, 680, 260, NULL, NULL, GetModuleHandleA(NULL), 0);
395 GetClientRect(hMainWnd, &rc);
396 ShowWindow(hMainWnd, SW_SHOW);
403 while(GetMessageA(&msg,0,0,0)) {
404 TranslateMessage(&msg);
405 DispatchMessageA(&msg);
407 DestroyWindow(hMainWnd);