ReactOS 0.4.15-dev-7991-ge77da17
capicon.c
Go to the documentation of this file.
1/*
2 * Copyright 2006 Saveliy Tretiakov
3 *
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.
8 *
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.
13 *
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.
17 */
18
19#include "windows.h"
20#include "stdio.h"
21#include "resource.h"
22
23WCHAR WndClass[] = L"capicon_class";
24
27
28
30 UINT msg,
33{
35
36 switch (msg)
37 {
38 case WM_GETICON:
39 if(testnum>2)
40 {
41 if(wParam == ICON_SMALL)
43 else if(wParam == ICON_BIG)
45 else hIcon = (HICON)1;
46
47 if(!hIcon)
48 {
49 printf("LoadIcon() failed: %d\n", (INT)GetLastError());
50 break;
51 }
52
53 return (LRESULT)hIcon;
54 }
55 break;
56
57 case WM_DESTROY:
59 return 0;
60 }
61
63}
64
65
66int wmain(int argc, wchar_t**argv)
67{
68 HWND hWnd;
69 MSG msg;
70 WNDCLASSEX wcx;
72
73 if(argc<2)
74 {
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"
79 "2. Class big 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");
83 return 0;
84 }
85
86 testnum = _wtoi(argv[1]);
87 if(testnum < 1 || testnum > 5)
88 {
89 printf("Unknown test %d\n", testnum);
90 return 1;
91 }
92
94
95 memset(&wcx, 0, sizeof(wcx));
96 wcx.cbSize = sizeof(wcx);
99 wcx.hInstance = hInst;
100 wcx.hbrBackground = (HBRUSH)COLOR_WINDOW;
103 if(testnum == 1 || testnum == 3)
105
106 if(!(result = RegisterClassEx(&wcx)))
107 {
108 printf("Shit! RegisterClassEx failed: %d\n",
109 (int)GetLastError());
110 return 1;
111 }
112
114 WndClass,
115 L"DrawCaption icon test",
119 250,
120 100,
121 NULL,
122 0,
123 hInst,
124 NULL);
125
126 if(!hWnd)
127 {
128 printf("Shit! Can't create wnd!\n");
130 return 1;
131 }
132
133
136
137 while(GetMessage(&msg, NULL, 0, 0 ))
138 {
141 }
142
144 return 0;
145}
static int argc
Definition: ServiceArgs.c:12
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: capicon.c:29
HINSTANCE hInst
Definition: capicon.c:25
INT testnum
Definition: capicon.c:26
WCHAR WndClass[]
Definition: capicon.c:23
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define CALLBACK
Definition: compat.h:35
#define printf
Definition: freeldr.h:97
GLuint64EXT * result
Definition: glext.h:11304
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
#define ID_ICON1SM
Definition: resource.h:5
#define ID_ICON2BIG
Definition: resource.h:6
#define ID_ICON2SM
Definition: resource.h:7
#define ID_ICON1BIG
Definition: resource.h:4
static HICON
Definition: imagelist.c:84
#define argv
Definition: mplay32.c:18
HICON hIcon
Definition: msconfig.c:44
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
#define WS_OVERLAPPED
Definition: pedump.c:615
#define WS_SYSMENU
Definition: pedump.c:629
#define WS_THICKFRAME
Definition: pedump.c:630
int wmain()
#define DefWindowProc
Definition: ros2win.h:31
#define memset(x, y, z)
Definition: compat.h:39
HINSTANCE hInstance
Definition: winuser.h:3206
HICON hIconSm
Definition: winuser.h:3212
UINT style
Definition: winuser.h:3202
UINT cbSize
Definition: winuser.h:3201
WNDPROC lpfnWndProc
Definition: winuser.h:3203
LPCSTR lpszClassName
Definition: winuser.h:3211
HICON hIcon
Definition: winuser.h:3207
HBRUSH hbrBackground
Definition: winuser.h:3209
#define ICON_BIG
Definition: tnclass.cpp:51
#define ICON_SMALL
Definition: tnclass.cpp:48
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
int32_t INT
Definition: typedefs.h:58
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define GetModuleHandle
Definition: winbase.h:3827
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define CS_VREDRAW
Definition: winuser.h:658
#define CreateWindowEx
Definition: winuser.h:5755
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define COLOR_WINDOW
Definition: winuser.h:918
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define CS_HREDRAW
Definition: winuser.h:653
#define UnregisterClass
Definition: winuser.h:5861
#define GetMessage
Definition: winuser.h:5790
#define RegisterClassEx
Definition: winuser.h:5837
#define LoadIcon
Definition: winuser.h:5813
BOOL WINAPI UpdateWindow(_In_ HWND)
#define CW_USEDEFAULT
Definition: winuser.h:225
#define SW_SHOW
Definition: winuser.h:775
#define WM_DESTROY
Definition: winuser.h:1609
#define DispatchMessage
Definition: winuser.h:5765
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906
#define MAKEINTRESOURCE
Definition: winuser.h:591
__wchar_t WCHAR
Definition: xmlstorage.h:180