ReactOS  0.4.13-dev-52-g0efcfec
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);
50  SetBkMode(hDc, TRANSPARENT);
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:
60  PostQuitMessage(0);
61  return 0;
62  }
63 
64  return DefWindowProcW(hWnd, msg, wParam, lParam);
65 }
BOOL WINAPI DrawCaption(_In_ HWND, _In_ HDC, _In_ LPCRECT, _In_ UINT)
static HDC
Definition: imagelist.c:92
HWND hWnd
Definition: settings.c:17
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define DC_ICON
Definition: winuser.h:429
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define TRANSPARENT
Definition: wingdi.h:949
#define WM_DESTROY
Definition: winuser.h:1591
#define DC_ACTIVE
Definition: winuser.h:427
#define WM_PAINT
Definition: winuser.h:1602
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define msg(x)
Definition: auth_time.c:54
LPARAM lParam
Definition: combotst.c:139
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define DC_TEXT
Definition: winuser.h:430
struct Rect Rect

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;
75  UINT result;
76 
77  memset(&wcx, 0, sizeof(wcx));
78  wcx.cbSize = sizeof(wcx);
80  wcx.hInstance = hInst;
81  wcx.hbrBackground = (HBRUSH)COLOR_WINDOW;
82  wcx.lpszClassName = WndClass;
83 
84  if (!(result = RegisterClassExW(&wcx)))
85  return 1;
86 
87  /* Load the user icons */
90 
91  /* WS_EX_DLGMODALFRAME */
93  WndClass,
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 }
BOOL WINAPI TranslateMessage(_In_ const MSG *)
static HICON
Definition: imagelist.c:84
#define LR_SHARED
Definition: winuser.h:1090
#define IMAGE_ICON
Definition: winuser.h:212
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
HICON hIconSm
Definition: sysicon.c:28
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
BOOL WINAPI UpdateWindow(_In_ HWND)
#define SM_CYSMICON
Definition: winuser.h:1003
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HICON hIcon
Definition: sysicon.c:28
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define COLOR_WINDOW
Definition: winuser.h:908
#define ICON_SMALL
Definition: tnclass.cpp:48
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: sysicon.c:30
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
WCHAR WndClass[]
Definition: sysicon.c:27
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:1956
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
LONG_PTR LPARAM
Definition: windef.h:208
#define SW_SHOW
Definition: winuser.h:769
LPCWSTR lpszClassName
Definition: winuser.h:3179
#define WS_CAPTION
Definition: pedump.c:624
#define LR_DEFAULTSIZE
Definition: winuser.h:1084
HBRUSH hbrBackground
Definition: winuser.h:3177
UINT cbSize
Definition: winuser.h:3169
int WINAPI GetSystemMetrics(_In_ int)
HINSTANCE hInstance
Definition: winuser.h:3174
#define SM_CXSMICON
Definition: winuser.h:1002
static const WCHAR L[]
Definition: oid.c:1250
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)
WNDPROC lpfnWndProc
Definition: winuser.h:3171
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
#define LR_COPYFROMRESOURCE
Definition: winuser.h:1089
HINSTANCE hInst
Definition: dxdiag.c:13
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
#define msg(x)
Definition: auth_time.c:54
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define WS_SYSMENU
Definition: pedump.c:629
GLuint64EXT * result
Definition: glext.h:11304
#define memset(x, y, z)
Definition: compat.h:39
#define ICON_BIG
Definition: tnclass.cpp:51

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().