ReactOS 0.4.16-dev-88-ga65b6ae
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:94
#define TRACE(s)
Definition: solgame.cpp:4
#define LoadIcon
Definition: winuser.h:5825
#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:1781
#define WM_RBUTTONUP
Definition: winuser.h:1783
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1784
#define WM_MOUSEMOVE
Definition: winuser.h:1778
#define WM_LBUTTONDOWN
Definition: winuser.h:1779
#define WM_DEVICECHANGE
Definition: winuser.h:1814
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:1782
#define WM_TIMER
Definition: winuser.h:1745
#define WM_LBUTTONUP
Definition: winuser.h:1780
#define WM_USER
Definition: winuser.h:1898
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:96
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2097

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:95
UINT cbSize
Definition: winuser.h:3414
DWORD dwFlags
Definition: winuser.h:3415
#define MKF_RIGHTBUTTONSEL
Definition: winuser.h:2156
#define MKF_MOUSEMODE
Definition: winuser.h:2157
#define SPI_GETMOUSEKEYS
Definition: winuser.h:1406
#define MKF_LEFTBUTTONDOWN
Definition: winuser.h:2153
#define MKF_LEFTBUTTONSEL
Definition: winuser.h:2155
#define MKF_INDICATOR
Definition: winuser.h:2150
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define MKF_RIGHTBUTTONDOWN
Definition: winuser.h:2154
#define MKF_MOUSEKEYSON
Definition: winuser.h:2145

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

◆ Power_Init()

HRESULT STDMETHODCALLTYPE Power_Init ( _In_ CSysTray pSysTray)

Definition at line 121 of file power.cpp.

122{
123 TRACE("Power_Init\n");
125
126 return pSysTray->NotifyIcon(NIM_ADD, ID_ICON_POWER, g_hIconBattery, g_strTooltip);
127}
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 236 of file power.cpp.

237{
238 TRACE("Power_Message uMsg=%d, wParam=%x, lParam=%x\n", uMsg, wParam, lParam);
239
240 switch (uMsg)
241 {
242 case WM_USER + 220:
243 TRACE("Power_Message: WM_USER+220\n");
245 {
246 if (lParam)
247 {
248 pSysTray->EnableService(POWER_SERVICE_FLAG, TRUE);
249 return Power_Init(pSysTray);
250 }
251 else
252 {
253 pSysTray->EnableService(POWER_SERVICE_FLAG, FALSE);
254 return Power_Shutdown(pSysTray);
255 }
256 }
257 return S_FALSE;
258
259 case WM_USER + 221:
260 TRACE("Power_Message: WM_USER+221\n");
262 {
263 lResult = (LRESULT)pSysTray->IsServiceEnabled(POWER_SERVICE_FLAG);
264 return S_OK;
265 }
266 return S_FALSE;
267
268 case WM_TIMER:
269 if (wParam == POWER_TIMER_ID)
270 {
271 KillTimer(pSysTray->GetHWnd(), POWER_TIMER_ID);
273 }
274 break;
275
276 case ID_ICON_POWER:
277 Power_Update(pSysTray);
278
279 switch (lParam)
280 {
281 case WM_LBUTTONDOWN:
282 SetTimer(pSysTray->GetHWnd(), POWER_TIMER_ID, GetDoubleClickTime(), NULL);
283 break;
284
285 case WM_LBUTTONUP:
286 break;
287
288 case WM_LBUTTONDBLCLK:
289 KillTimer(pSysTray->GetHWnd(), POWER_TIMER_ID);
290 _RunPower();
291 break;
292
293 case WM_RBUTTONDOWN:
294 break;
295
296 case WM_RBUTTONUP:
297 _ShowContextMenu(pSysTray);
298 break;
299
300 case WM_RBUTTONDBLCLK:
301 break;
302
303 case WM_MOUSEMOVE:
304 break;
305 }
306 return S_OK;
307
308 default:
309 TRACE("Power_Message received for unknown ID %d, ignoring.\n");
310 return S_FALSE;
311 }
312
313 return S_FALSE;
314}
static void _RunPower()
Definition: power.cpp:144
HRESULT STDMETHODCALLTYPE Power_Init(_In_ CSysTray *pSysTray)
Definition: power.cpp:121
HRESULT STDMETHODCALLTYPE Power_Shutdown(_In_ CSysTray *pSysTray)
Definition: power.cpp:137
HRESULT STDMETHODCALLTYPE Power_Update(_In_ CSysTray *pSysTray)
Definition: power.cpp:129
static void _ShowContextMenu(CSysTray *pSysTray)
Definition: power.cpp:149
static VOID ShowPowerSchemesPopupMenu(CSysTray *pSysTray)
Definition: power.cpp:201
#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 137 of file power.cpp.

138{
139 TRACE("Power_Shutdown\n");
140
141 return pSysTray->NotifyIcon(NIM_DELETE, ID_ICON_POWER, NULL, NULL);
142}

Referenced by Power_Message().

◆ Power_Update()

HRESULT STDMETHODCALLTYPE Power_Update ( _In_ CSysTray pSysTray)

Definition at line 129 of file power.cpp.

130{
131 TRACE("Power_Update\n");
133
134 return pSysTray->NotifyIcon(NIM_MODIFY, ID_ICON_POWER, g_hIconBattery, g_strTooltip);
135}

Referenced by Power_Message().

◆ Volume_Init()

HRESULT STDMETHODCALLTYPE Volume_Init ( _In_ CSysTray pSysTray)

Definition at line 136 of file volume.cpp.

137{
138 HRESULT hr;
139 WCHAR strTooltip[128];
140
141 TRACE("Volume_Init\n");
142
143 if (!g_hMixer)
144 {
145 hr = Volume_FindMixerControl(pSysTray);
146 if (FAILED(hr))
147 return hr;
148
149 g_mmDeviceChange = RegisterWindowMessageW(L"winmm_devicechange");
150 }
151
154
156
157 HICON icon;
158 if (g_IsMute)
159 icon = g_hIconMute;
160 else
161 icon = g_hIconVolume;
162
163 LoadStringW(g_hInstance, IDS_VOL_VOLUME, strTooltip, _countof(strTooltip));
164 return pSysTray->NotifyIcon(NIM_ADD, ID_ICON_VOLUME, icon, strTooltip);
165}
#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:80
HRESULT hr
Definition: shlfolder.c:183
#define _countof(array)
Definition: sndvol32.h:70
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 260 of file volume.cpp.

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

◆ Volume_Shutdown()

HRESULT STDMETHODCALLTYPE Volume_Shutdown ( _In_ CSysTray pSysTray)

Definition at line 199 of file volume.cpp.

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

Referenced by Volume_Message().

◆ Volume_Update()

HRESULT STDMETHODCALLTYPE Volume_Update ( _In_ CSysTray pSysTray)

Definition at line 167 of file volume.cpp.

168{
169 BOOL PrevState;
170
171 TRACE("Volume_Update\n");
172
173 PrevState = g_IsMute;
175
176 if (PrevState != g_IsMute)
177 {
178 WCHAR strTooltip[128];
179 HICON icon;
180 if (g_IsMute)
181 {
182 icon = g_hIconMute;
183 LoadStringW(g_hInstance, IDS_VOL_MUTED, strTooltip, _countof(strTooltip));
184 }
185 else
186 {
187 icon = g_hIconVolume;
188 LoadStringW(g_hInstance, IDS_VOL_VOLUME, strTooltip, _countof(strTooltip));
189 }
190
191 return pSysTray->NotifyIcon(NIM_MODIFY, ID_ICON_VOLUME, icon, strTooltip);
192 }
193 else
194 {
195 return S_OK;
196 }
197}
#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