ReactOS 0.4.16-dev-122-g325d74c
sysicon.c File Reference
#include <windows.h>
#include <stdio.h>
Include dependency graph for sysicon.c:

Go to the source code of this file.

Functions

LRESULT CALLBACK WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
int APIENTRY wWinMain (HINSTANCE hInst, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
 

Variables

WCHAR WndClass [] = L"sysicon_class"
 
HICON hIcon = NULL
 
HICON hIconSm = NULL
 

Function Documentation

◆ WndProc()

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

Definition at line 30 of file sysicon.c.

34{
35 switch (msg)
36 {
37 case WM_PAINT:
38 {
39 HDC hDc;
40 PAINTSTRUCT Ps;
41 RECT Rect;
43
44 Rect.left = 10;
45 Rect.top = 10;
46 Rect.right -= 10;
47 Rect.bottom = 25;
48
49 hDc = BeginPaint(hWnd, &Ps);
51
52 DrawCaption(hWnd, hDc, &Rect, DC_GRADIENT | DC_ACTIVE | DC_TEXT | DC_ICON);
53
54 EndPaint(hWnd, &Ps);
55
56 return 0;
57 }
58
59 case WM_DESTROY:
61 return 0;
62 }
63
65}
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define DC_ACTIVE
Definition: dc21x4.h:120
static HDC
Definition: imagelist.c:88
#define TRANSPARENT
Definition: wingdi.h:950
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
#define WM_PAINT
Definition: winuser.h:1623
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DrawCaption(_In_ HWND, _In_ HDC, _In_ LPCRECT, _In_ UINT)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define DC_TEXT
Definition: winuser.h:430
#define WM_DESTROY
Definition: winuser.h:1612
#define DC_ICON
Definition: winuser.h:429
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)

Referenced by wWinMain().

◆ wWinMain()

int APIENTRY wWinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPWSTR  lpCmdLine,
int  nShowCmd 
)

This file has no copyright assigned and is placed in the Public Domain. This file is part of the w64 mingw-runtime package. No warranty is given; refer to the file DISCLAIMER.PD within this package.

Definition at line 67 of file sysicon.c.

71{
72 HWND hWnd1a, hWnd1b, hWnd2a, hWnd2b, hWnd3a, hWnd3b;
73 MSG msg;
74 WNDCLASSEXW wcx;
76
77 memset(&wcx, 0, sizeof(wcx));
78 wcx.cbSize = sizeof(wcx);
80 wcx.hInstance = hInst;
81 wcx.hbrBackground = (HBRUSH)COLOR_WINDOW;
83
84 if (!(result = RegisterClassExW(&wcx)))
85 return 1;
86
87 /* Load the user icons */
90
91 /* WS_EX_DLGMODALFRAME */
94 L"WS_SYSMENU | WS_EX_DLGMODALFRAME without user icon",
97 400, 100,
98 NULL, 0,
99 hInst, NULL);
100 if (!hWnd1a)
101 return 1;
102
103 ShowWindow(hWnd1a, SW_SHOW);
104 UpdateWindow(hWnd1a);
105
106 /* WS_EX_DLGMODALFRAME */
108 WndClass,
109 L"WS_SYSMENU | WS_EX_DLGMODALFRAME with user icon",
112 400, 100,
113 NULL, 0,
114 hInst, NULL);
115
116 if (!hWnd1b)
117 return 1;
118
119 ShowWindow(hWnd1b, SW_SHOW);
120 UpdateWindow(hWnd1b);
121 SendMessageW(hWnd1b, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
122 SendMessageW(hWnd1b, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
123
125 WndClass,
126 L"WS_SYSMENU | WS_EX_TOOLWINDOW without user icon",
129 400, 100,
130 NULL, 0,
131 hInst, NULL);
132 if (!hWnd2a)
133 return 1;
134
135 ShowWindow(hWnd2a, SW_SHOW);
136 UpdateWindow(hWnd2a);
137
139 WndClass,
140 L"WS_SYSMENU | WS_EX_TOOLWINDOW with user icon",
143 400, 100,
144 NULL, 0,
145 hInst, NULL);
146 if (!hWnd2b)
147 return 1;
148
149 ShowWindow(hWnd2b, SW_SHOW);
150 UpdateWindow(hWnd2b);
151 SendMessageW(hWnd2b, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
152 SendMessageW(hWnd2b, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
153
154 hWnd3a = CreateWindowExW(0,
155 WndClass,
156 L"WS_SYSMENU without user icon",
159 400, 100,
160 NULL, 0,
161 hInst, NULL);
162 if (!hWnd3a)
163 return 1;
164
165 ShowWindow(hWnd3a, SW_SHOW);
166 UpdateWindow(hWnd3a);
167
168 hWnd3b = CreateWindowExW(0,
169 WndClass,
170 L"WS_SYSMENU with user icon",
173 400, 100,
174 NULL, 0,
175 hInst, NULL);
176 if (!hWnd3b)
177 return 1;
178
179 ShowWindow(hWnd3b, SW_SHOW);
180 UpdateWindow(hWnd3b);
181 SendMessageW(hWnd3b, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
182 SendMessageW(hWnd3b, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
183
184 while(GetMessageW(&msg, NULL, 0, 0 ))
185 {
188 }
189
190 if (hIcon) DestroyIcon(hIcon);
192
194 return 0;
195}
#define NULL
Definition: types.h:112
HINSTANCE hInst
Definition: dxdiag.c:13
GLuint64EXT * result
Definition: glext.h:11304
static HICON
Definition: imagelist.c:80
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
#define WS_CAPTION
Definition: pedump.c:624
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
#define WS_SYSMENU
Definition: pedump.c:629
#define memset(x, y, z)
Definition: compat.h:39
LPCWSTR lpszClassName
Definition: winuser.h:3229
HBRUSH hbrBackground
Definition: winuser.h:3227
WNDPROC lpfnWndProc
Definition: winuser.h:3221
UINT cbSize
Definition: winuser.h:3219
HINSTANCE hInstance
Definition: winuser.h:3224
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: sysicon.c:30
HICON hIcon
Definition: sysicon.c:28
WCHAR WndClass[]
Definition: sysicon.c:27
HICON hIconSm
Definition: sysicon.c:28
#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
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define COLOR_WINDOW
Definition: winuser.h:921
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
#define IMAGE_ICON
Definition: winuser.h:212
#define LR_COPYFROMRESOURCE
Definition: winuser.h:1102
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2255
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define SM_CYSMICON
Definition: winuser.h:1016
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2024
#define SM_CXSMICON
Definition: winuser.h:1015
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI UpdateWindow(_In_ HWND)
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
#define LR_SHARED
Definition: winuser.h:1103
#define CW_USEDEFAULT
Definition: winuser.h:225
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
#define SW_SHOW
Definition: winuser.h:778
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
#define LR_DEFAULTSIZE
Definition: winuser.h:1097
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2909
int WINAPI GetSystemMetrics(_In_ int)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2105

Variable Documentation

◆ hIcon

HICON hIcon = NULL

Definition at line 28 of file sysicon.c.

Referenced by wWinMain().

◆ hIconSm

HICON hIconSm = NULL

Definition at line 28 of file sysicon.c.

Referenced by wWinMain().

◆ WndClass

WCHAR WndClass[] = L"sysicon_class"

Definition at line 27 of file sysicon.c.

Referenced by wWinMain().