ReactOS 0.4.15-dev-5884-gab5aff5
precomp.h File Reference
#include <stdarg.h>
#include <tchar.h>
#include <windef.h>
#include <winbase.h>
#include <shlguid_undoc.h>
#include <shlobj.h>
#include <strsafe.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <atlstr.h>
#include <setupapi.h>
#include <shellapi.h>
#include <wine/debug.h>
#include "resource.h"
#include "csystray.h"
Include dependency graph for precomp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SysTrayIconHandlers_t
 

Macros

#define WIN32_NO_STATUS
 
#define COBJMACROS
 
#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define NTOS_MODE_USER
 
#define ID_ICON_VOLUME   (WM_APP + 0x4CB)
 
#define ID_ICON_HOTPLUG   (WM_APP + 0x4CC)
 
#define ID_ICON_POWER   (WM_APP + 0x4CD)
 
#define ID_ICON_MOUSE   (WM_APP + 0x4CE)
 
#define POWER_SERVICE_FLAG   0x00000001
 
#define HOTPLUG_SERVICE_FLAG   0x00000002
 
#define VOLUME_SERVICE_FLAG   0x00000004
 
#define POWER_TIMER_ID   2
 
#define VOLUME_TIMER_ID   3
 
#define HOTPLUG_TIMER_ID   4
 
#define HOTPLUG_DEVICE_TIMER_ID   5
 

Typedefs

typedef HRESULT(STDMETHODCALLTYPEPFNSTINIT) (_In_ CSysTray *pSysTray)
 
typedef HRESULT(STDMETHODCALLTYPEPFNSTSHUTDOWN) (_In_ CSysTray *pSysTray)
 
typedef HRESULT(STDMETHODCALLTYPEPFNSTUPDATE) (_In_ CSysTray *pSysTray)
 
typedef HRESULT(STDMETHODCALLTYPEPFNSTMESSAGE) (_In_ CSysTray *pSysTray, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (stobject)
 
HRESULT STDMETHODCALLTYPE Volume_Init (_In_ CSysTray *pSysTray)
 
HRESULT STDMETHODCALLTYPE Volume_Shutdown (_In_ CSysTray *pSysTray)
 
HRESULT STDMETHODCALLTYPE Volume_Update (_In_ CSysTray *pSysTray)
 
HRESULT STDMETHODCALLTYPE Volume_Message (_In_ CSysTray *pSysTray, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult)
 
HRESULT STDMETHODCALLTYPE Hotplug_Init (_In_ CSysTray *pSysTray)
 
HRESULT STDMETHODCALLTYPE Hotplug_Shutdown (_In_ CSysTray *pSysTray)
 
HRESULT STDMETHODCALLTYPE Hotplug_Update (_In_ CSysTray *pSysTray)
 
HRESULT STDMETHODCALLTYPE Hotplug_Message (_In_ CSysTray *pSysTray, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult)
 
HRESULT STDMETHODCALLTYPE Power_Init (_In_ CSysTray *pSysTray)
 
HRESULT STDMETHODCALLTYPE Power_Shutdown (_In_ CSysTray *pSysTray)
 
HRESULT STDMETHODCALLTYPE Power_Update (_In_ CSysTray *pSysTray)
 
HRESULT STDMETHODCALLTYPE Power_Message (_In_ CSysTray *pSysTray, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult)
 
HRESULT STDMETHODCALLTYPE MouseKeys_Init (_In_ CSysTray *pSysTray)
 
HRESULT STDMETHODCALLTYPE MouseKeys_Shutdown (_In_ CSysTray *pSysTray)
 
HRESULT STDMETHODCALLTYPE MouseKeys_Update (_In_ CSysTray *pSysTray)
 

Variables

HINSTANCE g_hInstance
 
SysTrayIconHandlers_t g_IconHandlers []
 
const int g_NumIcons
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 10 of file precomp.h.

◆ COBJMACROS

#define COBJMACROS

Definition at line 8 of file precomp.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 11 of file precomp.h.

◆ HOTPLUG_DEVICE_TIMER_ID

#define HOTPLUG_DEVICE_TIMER_ID   5

Definition at line 86 of file precomp.h.

◆ HOTPLUG_SERVICE_FLAG

#define HOTPLUG_SERVICE_FLAG   0x00000002

Definition at line 39 of file precomp.h.

◆ HOTPLUG_TIMER_ID

#define HOTPLUG_TIMER_ID   4

Definition at line 85 of file precomp.h.

◆ ID_ICON_HOTPLUG

#define ID_ICON_HOTPLUG   (WM_APP + 0x4CC)

Definition at line 34 of file precomp.h.

◆ ID_ICON_MOUSE

#define ID_ICON_MOUSE   (WM_APP + 0x4CE)

Definition at line 36 of file precomp.h.

◆ ID_ICON_POWER

#define ID_ICON_POWER   (WM_APP + 0x4CD)

Definition at line 35 of file precomp.h.

◆ ID_ICON_VOLUME

#define ID_ICON_VOLUME   (WM_APP + 0x4CB)

Definition at line 33 of file precomp.h.

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 12 of file precomp.h.

◆ POWER_SERVICE_FLAG

#define POWER_SERVICE_FLAG   0x00000001

Definition at line 38 of file precomp.h.

◆ POWER_TIMER_ID

#define POWER_TIMER_ID   2

Definition at line 83 of file precomp.h.

◆ VOLUME_SERVICE_FLAG

#define VOLUME_SERVICE_FLAG   0x00000004

Definition at line 40 of file precomp.h.

◆ VOLUME_TIMER_ID

#define VOLUME_TIMER_ID   3

Definition at line 84 of file precomp.h.

◆ WIN32_NO_STATUS [1/2]

#define WIN32_NO_STATUS

Definition at line 9 of file precomp.h.

◆ WIN32_NO_STATUS [2/2]

#define WIN32_NO_STATUS

Definition at line 9 of file precomp.h.

Typedef Documentation

◆ PFNSTINIT

typedef HRESULT(STDMETHODCALLTYPE * PFNSTINIT) (_In_ CSysTray *pSysTray)

Definition at line 44 of file precomp.h.

◆ PFNSTMESSAGE

typedef HRESULT(STDMETHODCALLTYPE * PFNSTMESSAGE) (_In_ CSysTray *pSysTray, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult)

Definition at line 47 of file precomp.h.

◆ PFNSTSHUTDOWN

typedef HRESULT(STDMETHODCALLTYPE * PFNSTSHUTDOWN) (_In_ CSysTray *pSysTray)

Definition at line 45 of file precomp.h.

◆ PFNSTUPDATE

typedef HRESULT(STDMETHODCALLTYPE * PFNSTUPDATE) (_In_ CSysTray *pSysTray)

Definition at line 46 of file precomp.h.

Function Documentation

◆ Hotplug_Init()

HRESULT STDMETHODCALLTYPE Hotplug_Init ( _In_ CSysTray pSysTray)

Definition at line 124 of file hotplug.cpp.

125{
126 TRACE("Hotplug_Init\n");
127
130
132
133 if (g_devList.GetSize() > 0)
134 return pSysTray->NotifyIcon(NIM_ADD, ID_ICON_HOTPLUG, g_hIconHotplug, g_strHotplugTooltip);
135 else
136 return pSysTray->NotifyIcon(NIM_ADD, ID_ICON_HOTPLUG, g_hIconHotplug, g_strHotplugTooltip, NIS_HIDDEN);
137}
HINSTANCE g_hInstance
Definition: MainWindow.cpp:18
#define ID_ICON_HOTPLUG
Definition: precomp.h:34
#define IDS_HOTPLUG_REMOVE_1
Definition: resource.h:18
#define IDI_HOTPLUG_OK
Definition: resource.h:57
HRESULT EnumHotpluggedDevices(CSimpleArray< DEVINST > &devList)
Definition: hotplug.cpp:35
static HICON g_hIconHotplug
Definition: hotplug.cpp:20
CSimpleArray< DEVINST > g_devList
Definition: hotplug.cpp:18
CString g_strHotplugTooltip
Definition: hotplug.cpp:19
#define NIM_ADD
Definition: shellapi.h:91
#define TRACE(s)
Definition: solgame.cpp:4
#define LoadIcon
Definition: winuser.h:5803
#define MAKEINTRESOURCE
Definition: winuser.h:591

Referenced by Hotplug_Message().

◆ Hotplug_Message()

HRESULT STDMETHODCALLTYPE Hotplug_Message ( _In_ CSysTray pSysTray,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT lResult 
)

Definition at line 258 of file hotplug.cpp.

259{
260 TRACE("Hotplug_Message uMsg=%d, wParam=%x, lParam=%x\n", uMsg, wParam, lParam);
261
262 switch (uMsg)
263 {
264 case WM_USER + 220:
265 TRACE("Hotplug_Message: WM_USER+220\n");
267 {
268 if (lParam)
269 {
270 pSysTray->EnableService(HOTPLUG_SERVICE_FLAG, TRUE);
271 return Hotplug_Init(pSysTray);
272 }
273 else
274 {
275 pSysTray->EnableService(HOTPLUG_SERVICE_FLAG, FALSE);
276 return Hotplug_Shutdown(pSysTray);
277 }
278 }
279 return S_FALSE;
280
281 case WM_USER + 221:
282 TRACE("Hotplug_Message: WM_USER+221\n");
284 {
285 lResult = (LRESULT)pSysTray->IsServiceEnabled(HOTPLUG_SERVICE_FLAG);
286 return S_OK;
287 }
288 return S_FALSE;
289
290 case WM_TIMER:
292 {
293 KillTimer(pSysTray->GetHWnd(), HOTPLUG_TIMER_ID);
294 _ShowContextMenu(pSysTray);
295 }
297 {
298 KillTimer(pSysTray->GetHWnd(), HOTPLUG_DEVICE_TIMER_ID);
299 HotplugDeviceTimer(pSysTray);
300 }
301 break;
302
303 case ID_ICON_HOTPLUG:
304 switch (lParam)
305 {
306 case WM_LBUTTONDOWN:
307 SetTimer(pSysTray->GetHWnd(), HOTPLUG_TIMER_ID, GetDoubleClickTime(), NULL);
308 break;
309
310 case WM_LBUTTONUP:
311 break;
312
313 case WM_LBUTTONDBLCLK:
314 KillTimer(pSysTray->GetHWnd(), HOTPLUG_TIMER_ID);
315 _RunHotplug(pSysTray);
316 break;
317
318 case WM_RBUTTONDOWN:
319 break;
320
321 case WM_RBUTTONUP:
322 _ShowContextMenuR(pSysTray);
323 break;
324
325 case WM_RBUTTONDBLCLK:
326 break;
327
328 case WM_MOUSEMOVE:
329 break;
330 }
331 return S_OK;
332
333 case WM_DEVICECHANGE:
334 switch (wParam)
335 {
337 TRACE("WM_DEVICECHANGE : DBT_DEVNODES_CHANGED\n");
338 SetTimer(pSysTray->GetHWnd(), HOTPLUG_DEVICE_TIMER_ID, 100, NULL);
339 lResult = true;
340 break;
341
343 break;
345 break;
347 break;
349 WCHAR strInfo[128];
350 swprintf(strInfo, L"The %wS can now be safely removed from the system.", g_strMenuSel);
351 NotifyBalloon(pSysTray, L"Safe to Remove Hardware", strInfo);
352
353 lResult = true;
354 break;
356 break;
357 }
358 return S_OK;
359
360 default:
361 TRACE("Hotplug_Message received for unknown ID %d, ignoring.\n");
362 return S_FALSE;
363 }
364
365 return S_FALSE;
366}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define DBT_DEVICEREMOVEPENDING
Definition: dbt.h:15
#define DBT_DEVNODES_CHANGED
Definition: dbt.h:28
#define DBT_DEVICEQUERYREMOVE
Definition: dbt.h:13
#define DBT_DEVICEARRIVAL
Definition: dbt.h:12
#define DBT_DEVICEREMOVECOMPLETE
Definition: dbt.h:16
#define DBT_DEVICEQUERYREMOVEFAILED
Definition: dbt.h:14
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define HOTPLUG_TIMER_ID
Definition: precomp.h:85
#define HOTPLUG_SERVICE_FLAG
Definition: precomp.h:39
#define HOTPLUG_DEVICE_TIMER_ID
Definition: precomp.h:86
#define swprintf
Definition: precomp.h:40
HRESULT NotifyBalloon(CSysTray *pSysTray, LPCWSTR szTitle=NULL, LPCWSTR szInfo=NULL, UINT uId=ID_ICON_HOTPLUG)
Definition: hotplug.cpp:94
HRESULT STDMETHODCALLTYPE Hotplug_Init(_In_ CSysTray *pSysTray)
Definition: hotplug.cpp:124
HRESULT STDMETHODCALLTYPE Hotplug_Shutdown(_In_ CSysTray *pSysTray)
Definition: hotplug.cpp:145
VOID HotplugDeviceTimer(_In_ CSysTray *pSysTray)
Definition: hotplug.cpp:244
static WCHAR g_strMenuSel[DISPLAY_NAME_LEN]
Definition: hotplug.cpp:21
static void _ShowContextMenuR(CSysTray *pSysTray)
Definition: hotplug.cpp:218
static void _RunHotplug(CSysTray *pSysTray)
Definition: hotplug.cpp:155
static void _ShowContextMenu(CSysTray *pSysTray)
Definition: hotplug.cpp:165
#define S_OK
Definition: intsafe.h:52
#define L(x)
Definition: ntvdm.h:50
#define LRESULT
Definition: ole.h:14
#define S_FALSE
Definition: winerror.h:2357
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1768
#define WM_RBUTTONUP
Definition: winuser.h:1770
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1771
#define WM_MOUSEMOVE
Definition: winuser.h:1765
#define WM_LBUTTONDOWN
Definition: winuser.h:1766
#define WM_DEVICECHANGE
Definition: winuser.h:1801
UINT WINAPI GetDoubleClickTime(void)
Definition: ntwrapper.h:314
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_RBUTTONDOWN
Definition: winuser.h:1769
#define WM_TIMER
Definition: winuser.h:1732
#define WM_LBUTTONUP
Definition: winuser.h:1767
#define WM_USER
Definition: winuser.h:1885
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ Hotplug_Shutdown()

HRESULT STDMETHODCALLTYPE Hotplug_Shutdown ( _In_ CSysTray pSysTray)

Definition at line 145 of file hotplug.cpp.

146{
147 TRACE("Hotplug_Shutdown\n");
148
151
152 return pSysTray->NotifyIcon(NIM_DELETE, ID_ICON_HOTPLUG, NULL, NULL);
153}
#define NIM_DELETE
Definition: shellapi.h:93
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022

Referenced by Hotplug_Message().

◆ Hotplug_Update()

HRESULT STDMETHODCALLTYPE Hotplug_Update ( _In_ CSysTray pSysTray)

Definition at line 139 of file hotplug.cpp.

140{
141 TRACE("Hotplug_Update\n");
142 return S_OK;
143}

◆ MouseKeys_Init()

HRESULT STDMETHODCALLTYPE MouseKeys_Init ( _In_ CSysTray pSysTray)

Definition at line 15 of file mouse.cpp.

16{
17 TRACE("MouseKeys_Init!\n");
18
19 return MouseKeys_Update(pSysTray);
20}
HRESULT STDMETHODCALLTYPE MouseKeys_Update(_In_ CSysTray *pSysTray)
Definition: mouse.cpp:43

Referenced by CSysTray::InitIcons().

◆ MouseKeys_Shutdown()

HRESULT STDMETHODCALLTYPE MouseKeys_Shutdown ( _In_ CSysTray pSysTray)

Definition at line 23 of file mouse.cpp.

24{
25 TRACE("MouseKeys_Shutdown!\n");
26
27 if (g_MkStateIcon)
28 {
31 }
32
33 if (g_MkState)
34 {
35 g_MkState = 0;
36 pSysTray->NotifyIcon(NIM_DELETE, ID_ICON_MOUSE, g_MkStateIcon, L"MouseKeys");
37 }
38
39 return S_OK;
40}
static UINT g_MkState
Definition: mouse.cpp:11
static HICON g_MkStateIcon
Definition: mouse.cpp:12
#define ID_ICON_MOUSE
Definition: precomp.h:36

Referenced by CSysTray::ShutdownIcons().

◆ MouseKeys_Update()

HRESULT STDMETHODCALLTYPE MouseKeys_Update ( _In_ CSysTray pSysTray)

Definition at line 43 of file mouse.cpp.

44{
45 TRACE("MouseKeys_Update!\n");
46
47 g_Mk.cbSize = sizeof(g_Mk);
49
50 UINT state = 0;
52 {
54 {
56 {
57 case 0:
58 default:
60 break;
63 break;
67 break;
70 break;
74 break;
77 break;
83 break;
87 break;
91 break;
92 }
93 }
94 else
95 {
97 }
98 }
99
100 UINT uId = NIM_MODIFY;
101 if (state != g_MkState)
102 {
103 if (g_MkStateIcon)
104 {
107 }
108
109 if (g_MkState == 0)
110 uId = NIM_ADD;
111
113 if (g_MkState)
114 {
116 }
117 }
118
119 if (g_MkState == 0)
120 {
121 uId = NIM_DELETE;
122 }
123
124 return pSysTray->NotifyIcon(uId, ID_ICON_MOUSE, g_MkStateIcon, L"MouseKeys");
125}
static int state
Definition: maze.c:121
static MOUSEKEYS g_Mk
Definition: mouse.cpp:10
#define IDI_MOUSE_R_DOWN
Definition: resource.h:64
#define IDI_MOUSE_R_ACTIVE
Definition: resource.h:63
#define IDI_MOUSE_R_ACTIVE_L_DOWN
Definition: resource.h:68
#define IDI_MOUSE_L_ACTIVE_R_DOWN
Definition: resource.h:67
#define IDI_MOUSE_L_DOWN
Definition: resource.h:62
#define IDI_MOUSE_NOBTN
Definition: resource.h:60
#define IDI_MOUSE_L_ACTIVE
Definition: resource.h:61
#define IDI_MOUSE_LR_DOWN
Definition: resource.h:66
#define IDI_MOUSE_DISABLED
Definition: resource.h:59
#define IDI_MOUSE_LR_ACTIVE
Definition: resource.h:65
unsigned int UINT
Definition: ndis.h:50
#define NIM_MODIFY
Definition: shellapi.h:92
UINT cbSize
Definition: winuser.h:3401
DWORD dwFlags
Definition: winuser.h:3402
#define MKF_RIGHTBUTTONSEL
Definition: winuser.h:2143
#define MKF_MOUSEMODE
Definition: winuser.h:2144
#define SPI_GETMOUSEKEYS
Definition: winuser.h:1393
#define MKF_LEFTBUTTONDOWN
Definition: winuser.h:2140
#define MKF_LEFTBUTTONSEL
Definition: winuser.h:2142
#define MKF_INDICATOR
Definition: winuser.h:2137
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define MKF_RIGHTBUTTONDOWN
Definition: winuser.h:2141
#define MKF_MOUSEKEYSON
Definition: winuser.h:2132

Referenced by MouseKeys_Init(), and CSysTray::ProcessWindowMessage().

◆ Power_Init()

HRESULT STDMETHODCALLTYPE Power_Init ( _In_ CSysTray pSysTray)

Definition at line 115 of file power.cpp.

116{
117 TRACE("Power_Init\n");
119
120 return pSysTray->NotifyIcon(NIM_ADD, ID_ICON_POWER, g_hIconBattery, g_strTooltip);
121}
static HICON g_hIconBattery
Definition: power.cpp:30
CString g_strTooltip
Definition: power.cpp:29
static HICON DynamicLoadIcon(HINSTANCE hinst)
Definition: power.cpp:77
#define ID_ICON_POWER
Definition: precomp.h:35

Referenced by Power_Message().

◆ Power_Message()

HRESULT STDMETHODCALLTYPE Power_Message ( _In_ CSysTray pSysTray,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT lResult 
)

Definition at line 230 of file power.cpp.

231{
232 TRACE("Power_Message uMsg=%d, wParam=%x, lParam=%x\n", uMsg, wParam, lParam);
233
234 switch (uMsg)
235 {
236 case WM_USER + 220:
237 TRACE("Power_Message: WM_USER+220\n");
239 {
240 if (lParam)
241 {
242 pSysTray->EnableService(POWER_SERVICE_FLAG, TRUE);
243 return Power_Init(pSysTray);
244 }
245 else
246 {
247 pSysTray->EnableService(POWER_SERVICE_FLAG, FALSE);
248 return Power_Shutdown(pSysTray);
249 }
250 }
251 return S_FALSE;
252
253 case WM_USER + 221:
254 TRACE("Power_Message: WM_USER+221\n");
256 {
257 lResult = (LRESULT)pSysTray->IsServiceEnabled(POWER_SERVICE_FLAG);
258 return S_OK;
259 }
260 return S_FALSE;
261
262 case WM_TIMER:
263 if (wParam == POWER_TIMER_ID)
264 {
265 KillTimer(pSysTray->GetHWnd(), POWER_TIMER_ID);
267 }
268 break;
269
270 case ID_ICON_POWER:
271 Power_Update(pSysTray);
272
273 switch (lParam)
274 {
275 case WM_LBUTTONDOWN:
276 SetTimer(pSysTray->GetHWnd(), POWER_TIMER_ID, GetDoubleClickTime(), NULL);
277 break;
278
279 case WM_LBUTTONUP:
280 break;
281
282 case WM_LBUTTONDBLCLK:
283 KillTimer(pSysTray->GetHWnd(), POWER_TIMER_ID);
284 _RunPower();
285 break;
286
287 case WM_RBUTTONDOWN:
288 break;
289
290 case WM_RBUTTONUP:
291 _ShowContextMenu(pSysTray);
292 break;
293
294 case WM_RBUTTONDBLCLK:
295 break;
296
297 case WM_MOUSEMOVE:
298 break;
299 }
300 return S_OK;
301
302 default:
303 TRACE("Power_Message received for unknown ID %d, ignoring.\n");
304 return S_FALSE;
305 }
306
307 return S_FALSE;
308}
static void _RunPower()
Definition: power.cpp:138
HRESULT STDMETHODCALLTYPE Power_Init(_In_ CSysTray *pSysTray)
Definition: power.cpp:115
HRESULT STDMETHODCALLTYPE Power_Shutdown(_In_ CSysTray *pSysTray)
Definition: power.cpp:131
HRESULT STDMETHODCALLTYPE Power_Update(_In_ CSysTray *pSysTray)
Definition: power.cpp:123
static void _ShowContextMenu(CSysTray *pSysTray)
Definition: power.cpp:143
static VOID ShowPowerSchemesPopupMenu(CSysTray *pSysTray)
Definition: power.cpp:195
#define POWER_TIMER_ID
Definition: precomp.h:83
#define POWER_SERVICE_FLAG
Definition: precomp.h:38

◆ Power_Shutdown()

HRESULT STDMETHODCALLTYPE Power_Shutdown ( _In_ CSysTray pSysTray)

Definition at line 131 of file power.cpp.

132{
133 TRACE("Power_Shutdown\n");
134
135 return pSysTray->NotifyIcon(NIM_DELETE, ID_ICON_POWER, NULL, NULL);
136}

Referenced by Power_Message().

◆ Power_Update()

HRESULT STDMETHODCALLTYPE Power_Update ( _In_ CSysTray pSysTray)

Definition at line 123 of file power.cpp.

124{
125 TRACE("Power_Update\n");
127
128 return pSysTray->NotifyIcon(NIM_MODIFY, ID_ICON_POWER, g_hIconBattery, g_strTooltip);
129}

Referenced by Power_Message().

◆ Volume_Init()

HRESULT STDMETHODCALLTYPE Volume_Init ( _In_ CSysTray pSysTray)

Definition at line 137 of file volume.cpp.

138{
139 HRESULT hr;
140 WCHAR strTooltip[128];
141
142 TRACE("Volume_Init\n");
143
144 if (!g_hMixer)
145 {
146 hr = Volume_FindMixerControl(pSysTray);
147 if (FAILED(hr))
148 return hr;
149
150 g_mmDeviceChange = RegisterWindowMessageW(L"winmm_devicechange");
151 }
152
155
157
158 HICON icon;
159 if (g_IsMute)
160 icon = g_hIconMute;
161 else
162 icon = g_hIconVolume;
163
164 LoadStringW(g_hInstance, IDS_VOL_VOLUME, strTooltip, _countof(strTooltip));
165 return pSysTray->NotifyIcon(NIM_ADD, ID_ICON_VOLUME, icon, strTooltip);
166}
#define ID_ICON_VOLUME
Definition: precomp.h:38
#define IDS_VOL_VOLUME
Definition: resource.h:32
#define IDI_VOLMUTE
Definition: resource.h:30
#define IDI_VOLUME
Definition: resource.h:29
#define FAILED(hr)
Definition: intsafe.h:51
static HICON
Definition: imagelist.c:84
HRESULT hr
Definition: shlfolder.c:183
#define _countof(array)
Definition: sndvol32.h:68
HRESULT Volume_IsMute()
Definition: volume.cpp:112
static BOOL g_IsMute
Definition: volume.cpp:23
UINT g_mmDeviceChange
Definition: volume.cpp:21
HICON g_hIconVolume
Definition: volume.cpp:13
static HRESULT __stdcall Volume_FindMixerControl(CSysTray *pSysTray)
Definition: volume.cpp:25
HMIXER g_hMixer
Definition: volume.cpp:16
HICON g_hIconMute
Definition: volume.cpp:14
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
UINT WINAPI RegisterWindowMessageW(_In_ LPCWSTR)

Referenced by Volume_Message().

◆ Volume_Message()

HRESULT STDMETHODCALLTYPE Volume_Message ( _In_ CSysTray pSysTray,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT lResult 
)

Definition at line 261 of file volume.cpp.

262{
263 if (uMsg == g_mmDeviceChange)
264 return Volume_OnDeviceChange(pSysTray, wParam, lParam);
265
266 switch (uMsg)
267 {
268 case WM_USER + 220:
269 TRACE("Volume_Message: WM_USER+220\n");
271 {
272 if (lParam)
273 {
274 pSysTray->EnableService(VOLUME_SERVICE_FLAG, TRUE);
275 return Volume_Init(pSysTray);
276 }
277 else
278 {
279 pSysTray->EnableService(VOLUME_SERVICE_FLAG, FALSE);
280 return Volume_Shutdown(pSysTray);
281 }
282 }
283 return S_FALSE;
284
285 case WM_USER + 221:
286 TRACE("Volume_Message: WM_USER+221\n");
288 {
289 lResult = (LRESULT)pSysTray->IsServiceEnabled(VOLUME_SERVICE_FLAG);
290 return S_OK;
291 }
292 return S_FALSE;
293
294 case WM_TIMER:
295 if (wParam == VOLUME_TIMER_ID)
296 {
297 KillTimer(pSysTray->GetHWnd(), VOLUME_TIMER_ID);
299 }
300 break;
301
302 case ID_ICON_VOLUME:
303 TRACE("Volume_Message uMsg=%d, w=%x, l=%x\n", uMsg, wParam, lParam);
304
305 Volume_Update(pSysTray);
306
307 switch (lParam)
308 {
309 case WM_LBUTTONDOWN:
310 SetTimer(pSysTray->GetHWnd(), VOLUME_TIMER_ID, GetDoubleClickTime(), NULL);
311 break;
312
313 case WM_LBUTTONUP:
314 break;
315
316 case WM_LBUTTONDBLCLK:
317 KillTimer(pSysTray->GetHWnd(), VOLUME_TIMER_ID);
319 break;
320
321 case WM_RBUTTONDOWN:
322 break;
323
324 case WM_RBUTTONUP:
325 _ShowContextMenu(pSysTray);
326 break;
327
328 case WM_RBUTTONDBLCLK:
329 break;
330
331 case WM_MOUSEMOVE:
332 break;
333 }
334 return S_OK;
335
336 default:
337 TRACE("Volume_Message received for unknown ID %d, ignoring.\n");
338 return S_FALSE;
339 }
340
341 return S_FALSE;
342}
#define VOLUME_TIMER_ID
Definition: precomp.h:84
#define VOLUME_SERVICE_FLAG
Definition: precomp.h:40
HRESULT STDMETHODCALLTYPE Volume_Init(_In_ CSysTray *pSysTray)
Definition: volume.cpp:137
HRESULT Volume_OnDeviceChange(_In_ CSysTray *pSysTray, WPARAM wParam, LPARAM lParam)
Definition: volume.cpp:207
static void _RunVolume(BOOL bTray)
Definition: volume.cpp:212
HRESULT STDMETHODCALLTYPE Volume_Shutdown(_In_ CSysTray *pSysTray)
Definition: volume.cpp:200
static void _ShowContextMenu(CSysTray *pSysTray)
Definition: volume.cpp:227
HRESULT STDMETHODCALLTYPE Volume_Update(_In_ CSysTray *pSysTray)
Definition: volume.cpp:168

◆ Volume_Shutdown()

HRESULT STDMETHODCALLTYPE Volume_Shutdown ( _In_ CSysTray pSysTray)

Definition at line 200 of file volume.cpp.

201{
202 TRACE("Volume_Shutdown\n");
203
204 return pSysTray->NotifyIcon(NIM_DELETE, ID_ICON_VOLUME, NULL, NULL);
205}

Referenced by Volume_Message().

◆ Volume_Update()

HRESULT STDMETHODCALLTYPE Volume_Update ( _In_ CSysTray pSysTray)

Definition at line 168 of file volume.cpp.

169{
170 BOOL PrevState;
171
172 TRACE("Volume_Update\n");
173
174 PrevState = g_IsMute;
176
177 if (PrevState != g_IsMute)
178 {
179 WCHAR strTooltip[128];
180 HICON icon;
181 if (g_IsMute)
182 {
183 icon = g_hIconMute;
184 LoadStringW(g_hInstance, IDS_VOL_MUTED, strTooltip, _countof(strTooltip));
185 }
186 else
187 {
188 icon = g_hIconVolume;
189 LoadStringW(g_hInstance, IDS_VOL_VOLUME, strTooltip, _countof(strTooltip));
190 }
191
192 return pSysTray->NotifyIcon(NIM_MODIFY, ID_ICON_VOLUME, icon, strTooltip);
193 }
194 else
195 {
196 return S_OK;
197 }
198}
#define IDS_VOL_MUTED
Definition: resource.h:36
unsigned int BOOL
Definition: ntddk_ex.h:94

Referenced by Volume_Message().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( stobject  )

Variable Documentation

◆ g_hInstance

HINSTANCE g_hInstance
extern

Definition at line 18 of file MainWindow.cpp.

◆ g_IconHandlers

◆ g_NumIcons