ReactOS 0.4.15-dev-7991-ge77da17
capicon.c File Reference
#include "windows.h"
#include "stdio.h"
#include "resource.h"
Include dependency graph for capicon.c:

Go to the source code of this file.

Functions

LRESULT CALLBACK WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
int wmain (int argc, wchar_t **argv)
 

Variables

WCHAR WndClass [] = L"capicon_class"
 
HINSTANCE hInst
 
INT testnum = 0
 

Function Documentation

◆ wmain()

int wmain ( int  argc,
wchar_t **  argv 
)

Definition at line 66 of file capicon.c.

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
#define NULL
Definition: types.h:112
#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_ICON1BIG
Definition: resource.h:4
#define argv
Definition: mplay32.c:18
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
#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
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define GetModuleHandle
Definition: winbase.h:3827
#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)
#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 DispatchMessage
Definition: winuser.h:5765
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906
#define MAKEINTRESOURCE
Definition: winuser.h:591

◆ WndProc()

LRESULT CALLBACK WndProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 29 of file capicon.c.

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}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define ID_ICON2BIG
Definition: resource.h:6
#define ID_ICON2SM
Definition: resource.h:7
static HICON
Definition: imagelist.c:84
HICON hIcon
Definition: msconfig.c:44
#define DefWindowProc
Definition: ros2win.h:31
#define ICON_BIG
Definition: tnclass.cpp:51
#define ICON_SMALL
Definition: tnclass.cpp:48
int32_t INT
Definition: typedefs.h:58
LONG_PTR LRESULT
Definition: windef.h:209
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_DESTROY
Definition: winuser.h:1609

Referenced by wmain().

Variable Documentation

◆ hInst

HINSTANCE hInst

Definition at line 25 of file capicon.c.

Referenced by wmain(), and WndProc().

◆ testnum

INT testnum = 0

Definition at line 26 of file capicon.c.

Referenced by wmain(), and WndProc().

◆ WndClass