2 * Copyright 2006 Saveliy Tretiakov
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 WCHAR WndClass
[] = L
"capicon_class";
29 LRESULT CALLBACK
WndProc(HWND hWnd
,
41 if(wParam
== ICON_SMALL
)
42 hIcon
= LoadIcon(hInst
, MAKEINTRESOURCE(ID_ICON2SM
));
43 else if(wParam
== ICON_BIG
)
44 hIcon
= LoadIcon(hInst
, MAKEINTRESOURCE(ID_ICON2BIG
));
45 else hIcon
= (HICON
)1;
49 printf("LoadIcon() failed: %d\n", (INT
)GetLastError());
53 return (LRESULT
)hIcon
;
62 return DefWindowProc(hWnd
, msg
, wParam
, lParam
);
66 INT
main(INT argc
, CHAR
**argv
)
75 printf("DrawCaption icon test.\n");
76 printf("USAGE: drawcap.exe <testnumber>\n\n");
77 printf("Available tests:\n"
78 "1. Class small icon\n"
80 "3. Class small icon + WM_GETICON\n"
81 "4. Class big icon + WM_GETICON\n"
82 "5. WM_GETICON only\n\n");
86 testnum
= atoi(argv
[1]);
87 if(testnum
< 1 || testnum
> 5)
89 printf("Unknown test %d\n", testnum
);
93 hInst
= GetModuleHandle(NULL
);
95 memset(&wcx
, 0, sizeof(wcx
));
96 wcx
.cbSize
= sizeof(wcx
);
97 wcx
.style
= CS_HREDRAW
| CS_VREDRAW
;
98 wcx
.lpfnWndProc
= (WNDPROC
) WndProc
;
99 wcx
.hInstance
= hInst
;
100 wcx
.hbrBackground
= (HBRUSH
)COLOR_WINDOW
;
101 wcx
.lpszClassName
= WndClass
;
102 if(testnum
<5)wcx
.hIcon
= LoadIcon(hInst
, MAKEINTRESOURCE(ID_ICON1BIG
));
103 if(testnum
== 1 || testnum
== 3)
104 wcx
.hIconSm
= LoadIcon(hInst
, MAKEINTRESOURCE(ID_ICON1SM
));
106 if(!(result
= RegisterClassEx(&wcx
)))
108 printf("Shit! RegisterClassEx failed: %d\n",
109 (int)GetLastError());
113 hWnd
= CreateWindowEx(0,
115 L
"DrawCaption icon test",
116 WS_OVERLAPPED
|WS_THICKFRAME
|WS_SYSMENU
,
128 printf("Shit! Can't create wnd!\n");
129 UnregisterClass(WndClass
, hInst
);
134 ShowWindow(hWnd
, SW_SHOW
);
137 while(GetMessage(&msg
, NULL
, 0, 0 ))
139 TranslateMessage(&msg
);
140 DispatchMessage(&msg
);
143 UnregisterClass(WndClass
, hInst
);