ReactOS  r76032
precomp.h File Reference
#include <stdarg.h>
#include <tchar.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <winuser.h>
#include <wincon.h>
#include <ddeml.h>
#include <shlguid_undoc.h>
#include <shlwapi.h>
#include <shlobj.h>
#include <shlobj_undoc.h>
#include <shlwapi_undoc.h>
#include <strsafe.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <undocshell.h>
#include <shellutils.h>
#include <shellapi.h>
#include <wine/debug.h>
#include <wine/unicode.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 GET_X_LPARAM(lp)   ((int)(short)LOWORD(lp))
 
#define GET_Y_LPARAM(lp)   ((int)(short)HIWORD(lp))
 
#define POWER_TIMER_ID   2
 
#define VOLUME_TIMER_ID   3
 

Typedefs

typedef UINT uMsg
 
typedef UINT WPARAM wParam
 
typedef UINT WPARAM LPARAM lParam
 
typedef UINT WPARAM LPARAM
LRESULT
lResult
 

Functions

typedef HRESULT (STDMETHODCALLTYPE *PFNSTINIT)(_In_ CSysTray *pSysTray)
 
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)
 
VOID Volume_OnTimer (HWND hWnd)
 
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)
 
VOID Hotplug_OnTimer (HWND hWnd)
 
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)
 
VOID Power_OnTimer (HWND hWnd)
 

Variables

HINSTANCE g_hInstance
 
SysTrayIconHandlers_t g_IconHandlers []
 
const int g_NumIcons
 

Macro Definition Documentation

#define _INC_WINDOWS

Definition at line 9 of file precomp.h.

#define COBJMACROS

Definition at line 7 of file precomp.h.

#define COM_NO_WINDOWS_H

Definition at line 10 of file precomp.h.

#define GET_X_LPARAM (   lp)    ((int)(short)LOWORD(lp))

Definition at line 45 of file precomp.h.

#define GET_Y_LPARAM (   lp)    ((int)(short)HIWORD(lp))

Definition at line 46 of file precomp.h.

#define ID_ICON_HOTPLUG   (WM_APP + 0x4CC)

Definition at line 42 of file precomp.h.

Referenced by Hotplug_Init(), Hotplug_Message(), and Hotplug_Shutdown().

#define ID_ICON_POWER   (WM_APP + 0x4CD)

Definition at line 43 of file precomp.h.

Referenced by Power_Init(), Power_Message(), and Power_Shutdown().

#define ID_ICON_VOLUME   (WM_APP + 0x4CB)

Definition at line 41 of file precomp.h.

#define NTOS_MODE_USER

Definition at line 11 of file precomp.h.

#define POWER_TIMER_ID   2

Definition at line 86 of file precomp.h.

Referenced by Power_Message(), Power_OnTimer(), and CSysTray::ProcessWindowMessage().

#define VOLUME_TIMER_ID   3

Definition at line 87 of file precomp.h.

Referenced by CSysTray::ProcessWindowMessage(), Volume_Message(), and Volume_OnTimer().

#define WIN32_NO_STATUS

Definition at line 8 of file precomp.h.

#define WIN32_NO_STATUS

Definition at line 8 of file precomp.h.

Typedef Documentation

Definition at line 53 of file precomp.h.

Definition at line 53 of file precomp.h.

typedef UINT uMsg

Definition at line 53 of file precomp.h.

typedef UINT WPARAM wParam

Definition at line 53 of file precomp.h.

Function Documentation

HRESULT STDMETHODCALLTYPE Hotplug_Init ( _In_ CSysTray pSysTray)

Definition at line 18 of file hotplug.cpp.

Referenced by Hotplug_Message().

19 {
20  WCHAR strTooltip[128];
21 
22  TRACE("Hotplug_Init\n");
23 
25 
26  LoadStringW(g_hInstance, IDS_HOTPLUG_REMOVE_1, strTooltip, _countof(strTooltip));
27 
28  g_IsRunning = TRUE;
29 
30  return pSysTray->NotifyIcon(NIM_ADD, ID_ICON_HOTPLUG, g_hIconHotplug, strTooltip);
31 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define TRUE
Definition: types.h:120
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: fontsub.cpp:30
#define IDS_HOTPLUG_REMOVE_1
Definition: resource.h:18
static HICON g_hIconHotplug
Definition: hotplug.cpp:14
#define ID_ICON_HOTPLUG
Definition: precomp.h:42
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define TRACE(s)
Definition: solgame.cpp:4
#define IDI_EXTRACT
Definition: resource.h:16
static BOOL g_IsRunning
Definition: hotplug.cpp:15
#define NIM_ADD
Definition: shellapi.h:73
#define LoadIcon
Definition: winuser.h:5658
HINSTANCE g_hInstance
Definition: MainWindow.cpp:18
HRESULT STDMETHODCALLTYPE Hotplug_Message ( _In_ CSysTray pSysTray,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT lResult 
)

Definition at line 112 of file hotplug.cpp.

113 {
114  TRACE("Hotplug_Message uMsg=%d, wParam=%x, lParam=%x\n", uMsg, wParam, lParam);
115 
116  switch (uMsg)
117  {
118  case WM_USER + 220:
119  TRACE("Hotplug_Message: WM_USER+220\n");
120  if (wParam == 2)
121  {
122  if (lParam == FALSE)
123  return Hotplug_Init(pSysTray);
124  else
125  return Hotplug_Shutdown(pSysTray);
126  }
127  return S_FALSE;
128 
129  case WM_USER + 221:
130  TRACE("Hotplug_Message: WM_USER+221\n");
131  if (wParam == 2)
132  {
134  return S_OK;
135  }
136  return S_FALSE;
137 
138  case ID_ICON_HOTPLUG:
139  Hotplug_Update(pSysTray);
140 
141  switch (lParam)
142  {
143  case WM_LBUTTONDOWN:
144  SetTimer(pSysTray->GetHWnd(), HOTPLUG_TIMER_ID, 500, NULL);
145  break;
146 
147  case WM_LBUTTONUP:
148  break;
149 
150  case WM_LBUTTONDBLCLK:
151  KillTimer(pSysTray->GetHWnd(), HOTPLUG_TIMER_ID);
152  RunHotplug();
153  break;
154 
155  case WM_RBUTTONDOWN:
156  break;
157 
158  case WM_RBUTTONUP:
159  ShowContextMenu(pSysTray);
160  break;
161 
162  case WM_RBUTTONDBLCLK:
163  break;
164 
165  case WM_MOUSEMOVE:
166  break;
167  }
168  return S_OK;
169 
170  default:
171  TRACE("Hotplug_Message received for unknown ID %d, ignoring.\n");
172  return S_FALSE;
173  }
174 
175  return S_FALSE;
176 }
#define LRESULT
Definition: msvc.h:49
#define WM_LBUTTONDOWN
Definition: winuser.h:1742
static void RunHotplug()
Definition: hotplug.cpp:48
#define ID_ICON_HOTPLUG
Definition: precomp.h:42
UINT uMsg
Definition: precomp.h:53
#define FALSE
Definition: types.h:117
HRESULT STDMETHODCALLTYPE Hotplug_Init(_In_ CSysTray *pSysTray)
Definition: hotplug.cpp:18
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:557
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define HOTPLUG_TIMER_ID
#define WM_RBUTTONDOWN
Definition: winuser.h:1745
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT STDMETHODCALLTYPE Hotplug_Shutdown(_In_ CSysTray *pSysTray)
Definition: hotplug.cpp:39
UINT WPARAM wParam
Definition: precomp.h:53
#define WM_RBUTTONUP
Definition: winuser.h:1746
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1744
static BOOL g_IsRunning
Definition: hotplug.cpp:15
#define WM_USER
Definition: winuser.h:1846
#define S_OK
Definition: intsafe.h:59
HRESULT STDMETHODCALLTYPE Hotplug_Update(_In_ CSysTray *pSysTray)
Definition: hotplug.cpp:33
#define WM_LBUTTONUP
Definition: winuser.h:1743
UINT WPARAM LPARAM lParam
Definition: precomp.h:53
#define WM_MOUSEMOVE
Definition: winuser.h:1741
static void ShowContextMenu(CSysTray *pSysTray)
Definition: hotplug.cpp:53
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1747
UINT WPARAM LPARAM LRESULT & lResult
Definition: precomp.h:53
VOID Hotplug_OnTimer ( HWND  hWnd)

Definition at line 179 of file hotplug.cpp.

Referenced by CSysTray::ProcessWindowMessage().

180 {
181  TRACE("Hotplug_OnTimer\n!");
184 }
HWND hWnd
Definition: settings.c:17
#define HOTPLUG_TIMER_ID
static VOID ShowHotplugPopupMenu(HWND hWnd)
Definition: hotplug.cpp:82
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
HRESULT STDMETHODCALLTYPE Hotplug_Shutdown ( _In_ CSysTray pSysTray)

Definition at line 39 of file hotplug.cpp.

Referenced by Hotplug_Message().

40 {
41  TRACE("Hotplug_Shutdown\n");
42 
44 
45  return pSysTray->NotifyIcon(NIM_DELETE, ID_ICON_HOTPLUG, NULL, NULL);
46 }
#define ID_ICON_HOTPLUG
Definition: precomp.h:42
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:557
#define TRACE(s)
Definition: solgame.cpp:4
#define NIM_DELETE
Definition: shellapi.h:75
static BOOL g_IsRunning
Definition: hotplug.cpp:15
HRESULT STDMETHODCALLTYPE Hotplug_Update ( _In_ CSysTray pSysTray)

Definition at line 33 of file hotplug.cpp.

Referenced by Hotplug_Message().

34 {
35  TRACE("Hotplug_Update\n");
36  return S_OK;
37 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
typedef HRESULT ( STDMETHODCALLTYPE PFNSTINIT)
HRESULT STDMETHODCALLTYPE Power_Init ( _In_ CSysTray pSysTray)

Definition at line 26 of file power.cpp.

Referenced by Power_Message().

27 {
28  WCHAR strTooltip[128];
29 
30  TRACE("Power_Init\n");
31 
33 
34  LoadStringW(g_hInstance, IDS_PWR_AC, strTooltip, _countof(strTooltip));
35 
36  g_IsRunning = TRUE;
37 
38  return pSysTray->NotifyIcon(NIM_ADD, ID_ICON_POWER, g_hIconBattery, strTooltip);
39 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define TRUE
Definition: types.h:120
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: fontsub.cpp:30
static HICON g_hIconBattery
Definition: power.cpp:22
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
static BOOL g_IsRunning
Definition: power.cpp:23
#define IDI_BATTERY
Definition: resource.h:15
#define TRACE(s)
Definition: solgame.cpp:4
#define ID_ICON_POWER
Definition: precomp.h:43
#define NIM_ADD
Definition: shellapi.h:73
#define LoadIcon
Definition: winuser.h:5658
HINSTANCE g_hInstance
Definition: MainWindow.cpp:18
#define IDS_PWR_AC
Definition: resource.h:11
HRESULT STDMETHODCALLTYPE Power_Message ( _In_ CSysTray pSysTray,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT lResult 
)

Definition at line 151 of file power.cpp.

152 {
153  TRACE("Power_Message uMsg=%d, wParam=%x, lParam=%x\n", uMsg, wParam, lParam);
154 
155  switch (uMsg)
156  {
157  case WM_USER + 220:
158  TRACE("Power_Message: WM_USER+220\n");
159  if (wParam == 1)
160  {
161  if (lParam == FALSE)
162  return Power_Init(pSysTray);
163  else
164  return Power_Shutdown(pSysTray);
165  }
166  return S_FALSE;
167 
168  case WM_USER + 221:
169  TRACE("Power_Message: WM_USER+221\n");
170  if (wParam == 1)
171  {
173  return S_OK;
174  }
175  return S_FALSE;
176 
177  case ID_ICON_POWER:
178  Power_Update(pSysTray);
179 
180  switch (lParam)
181  {
182  case WM_LBUTTONDOWN:
183  SetTimer(pSysTray->GetHWnd(), POWER_TIMER_ID, 500, NULL);
184  break;
185 
186  case WM_LBUTTONUP:
187  break;
188 
189  case WM_LBUTTONDBLCLK:
190  KillTimer(pSysTray->GetHWnd(), POWER_TIMER_ID);
191  RunPower();
192  break;
193 
194  case WM_RBUTTONDOWN:
195  break;
196 
197  case WM_RBUTTONUP:
198  ShowContextMenu(pSysTray);
199  break;
200 
201  case WM_RBUTTONDBLCLK:
202  break;
203 
204  case WM_MOUSEMOVE:
205  break;
206  }
207  return S_OK;
208 
209  default:
210  TRACE("Power_Message received for unknown ID %d, ignoring.\n");
211  return S_FALSE;
212  }
213 
214  return S_FALSE;
215 }
HRESULT STDMETHODCALLTYPE Power_Init(_In_ CSysTray *pSysTray)
Definition: power.cpp:26
#define LRESULT
Definition: msvc.h:49
#define WM_LBUTTONDOWN
Definition: winuser.h:1742
static void RunPower()
Definition: power.cpp:56
HRESULT STDMETHODCALLTYPE Power_Update(_In_ CSysTray *pSysTray)
Definition: power.cpp:41
UINT uMsg
Definition: precomp.h:53
#define FALSE
Definition: types.h:117
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:557
static BOOL g_IsRunning
Definition: power.cpp:23
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_RBUTTONDOWN
Definition: winuser.h:1745
#define TRACE(s)
Definition: solgame.cpp:4
#define ID_ICON_POWER
Definition: precomp.h:43
UINT WPARAM wParam
Definition: precomp.h:53
#define WM_RBUTTONUP
Definition: winuser.h:1746
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1744
#define WM_USER
Definition: winuser.h:1846
#define S_OK
Definition: intsafe.h:59
static void ShowContextMenu(CSysTray *pSysTray)
Definition: power.cpp:61
#define POWER_TIMER_ID
Definition: precomp.h:86
#define WM_LBUTTONUP
Definition: winuser.h:1743
UINT WPARAM LPARAM lParam
Definition: precomp.h:53
#define WM_MOUSEMOVE
Definition: winuser.h:1741
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1747
HRESULT STDMETHODCALLTYPE Power_Shutdown(_In_ CSysTray *pSysTray)
Definition: power.cpp:47
UINT WPARAM LPARAM LRESULT & lResult
Definition: precomp.h:53
VOID Power_OnTimer ( HWND  hWnd)

Definition at line 218 of file power.cpp.

Referenced by CSysTray::ProcessWindowMessage().

219 {
220  TRACE("Power_OnTimer\n!");
223 }
static VOID ShowPowerSchemesPopupMenu(HWND hWnd)
Definition: power.cpp:116
HWND hWnd
Definition: settings.c:17
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define POWER_TIMER_ID
Definition: precomp.h:86
HRESULT STDMETHODCALLTYPE Power_Shutdown ( _In_ CSysTray pSysTray)

Definition at line 47 of file power.cpp.

Referenced by Power_Message().

48 {
49  TRACE("Power_Shutdown\n");
50 
52 
53  return pSysTray->NotifyIcon(NIM_DELETE, ID_ICON_POWER, NULL, NULL);
54 }
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:557
static BOOL g_IsRunning
Definition: power.cpp:23
#define TRACE(s)
Definition: solgame.cpp:4
#define ID_ICON_POWER
Definition: precomp.h:43
#define NIM_DELETE
Definition: shellapi.h:75
HRESULT STDMETHODCALLTYPE Power_Update ( _In_ CSysTray pSysTray)

Definition at line 41 of file power.cpp.

Referenced by Power_Message().

42 {
43  TRACE("Power_Update\n");
44  return S_OK;
45 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
HRESULT STDMETHODCALLTYPE Volume_Init ( _In_ CSysTray pSysTray)

Definition at line 141 of file volume.cpp.

Referenced by Volume_Message().

142 {
143  HRESULT hr;
144  WCHAR strTooltip[128];
145 
146  TRACE("Volume_Init\n");
147 
148  if (!g_hMixer)
149  {
150  hr = Volume_FindMixerControl(pSysTray);
151  if (FAILED(hr))
152  return hr;
153 
154  g_mmDeviceChange = RegisterWindowMessageW(L"winmm_devicechange");
155  }
156 
159 
160  Volume_IsMute();
161 
162  g_IsRunning = TRUE;
163 
164  HICON icon;
165  if (g_IsMute)
166  icon = g_hIconMute;
167  else
168  icon = g_hIconVolume;
169 
170  LoadStringW(g_hInstance, IDS_VOL_VOLUME, strTooltip, _countof(strTooltip));
171  return pSysTray->NotifyIcon(NIM_ADD, ID_ICON_VOLUME, icon, strTooltip);
172 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDI_VOLMUTE
Definition: resource.h:30
#define TRUE
Definition: types.h:120
Definition: bidi.c:75
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: fontsub.cpp:30
#define IDS_VOL_VOLUME
Definition: resource.h:32
UINT g_mmDeviceChange
Definition: volume.cpp:24
HRESULT Volume_IsMute(VOID)
Definition: volume.cpp:116
static HRESULT __stdcall Volume_FindMixerControl(CSysTray *pSysTray)
Definition: volume.cpp:29
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HICON g_hIconMute
Definition: volume.cpp:17
#define ID_ICON_VOLUME
Definition: precomp.h:43
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static BOOL g_IsMute
Definition: volume.cpp:26
UINT WINAPI RegisterWindowMessageW(_In_ LPCWSTR)
HICON g_hIconVolume
Definition: volume.cpp:16
#define NIM_ADD
Definition: shellapi.h:73
static BOOL g_IsRunning
Definition: volume.cpp:27
HMIXER g_hMixer
Definition: volume.cpp:19
#define LoadIcon
Definition: winuser.h:5658
HINSTANCE g_hInstance
Definition: MainWindow.cpp:18
#define IDI_VOLUME
Definition: resource.h:29
HRESULT STDMETHODCALLTYPE Volume_Message ( _In_ CSysTray pSysTray,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT lResult 
)

Definition at line 264 of file volume.cpp.

265 {
266  if (uMsg == g_mmDeviceChange)
267  return Volume_OnDeviceChange(pSysTray, wParam, lParam);
268 
269  switch (uMsg)
270  {
271  case WM_USER + 220:
272  TRACE("Volume_Message: WM_USER+220\n");
273  if (wParam == 4)
274  {
275  if (lParam == FALSE)
276  return Volume_Init(pSysTray);
277  else
278  return Volume_Shutdown(pSysTray);
279  }
280  return S_FALSE;
281 
282  case WM_USER + 221:
283  TRACE("Volume_Message: WM_USER+221\n");
284  if (wParam == 4)
285  {
287  return S_OK;
288  }
289  return S_FALSE;
290 
291  case ID_ICON_VOLUME:
292  TRACE("Volume_Message uMsg=%d, w=%x, l=%x\n", uMsg, wParam, lParam);
293 
294  Volume_Update(pSysTray);
295 
296  switch (lParam)
297  {
298  case WM_LBUTTONDOWN:
299  SetTimer(pSysTray->GetHWnd(), VOLUME_TIMER_ID, 500, NULL);
300  break;
301 
302  case WM_LBUTTONUP:
303  break;
304 
305  case WM_LBUTTONDBLCLK:
306  KillTimer(pSysTray->GetHWnd(), VOLUME_TIMER_ID);
307  _RunVolume(FALSE);
308  break;
309 
310  case WM_RBUTTONDOWN:
311  break;
312 
313  case WM_RBUTTONUP:
314  _ShowContextMenu(pSysTray);
315  break;
316 
317  case WM_RBUTTONDBLCLK:
318  break;
319 
320  case WM_MOUSEMOVE:
321  break;
322  }
323  return S_OK;
324 
325  default:
326  TRACE("Volume_Message received for unknown ID %d, ignoring.\n");
327  return S_FALSE;
328  }
329 
330  return S_FALSE;
331 }
#define LRESULT
Definition: msvc.h:49
#define WM_LBUTTONDOWN
Definition: winuser.h:1742
UINT uMsg
Definition: precomp.h:53
UINT g_mmDeviceChange
Definition: volume.cpp:24
#define FALSE
Definition: types.h:117
HRESULT STDMETHODCALLTYPE Volume_Update(_In_ CSysTray *pSysTray)
Definition: volume.cpp:174
#define ID_ICON_VOLUME
Definition: precomp.h:43
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:557
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_RBUTTONDOWN
Definition: winuser.h:1745
#define TRACE(s)
Definition: solgame.cpp:4
#define VOLUME_TIMER_ID
Definition: precomp.h:87
static void _RunVolume(BOOL bSmall)
Definition: volume.cpp:220
UINT WPARAM wParam
Definition: precomp.h:53
HRESULT Volume_OnDeviceChange(_In_ CSysTray *pSysTray, WPARAM wParam, LPARAM lParam)
Definition: volume.cpp:215
#define WM_RBUTTONUP
Definition: winuser.h:1746
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1744
#define WM_USER
Definition: winuser.h:1846
#define S_OK
Definition: intsafe.h:59
#define WM_LBUTTONUP
Definition: winuser.h:1743
HRESULT STDMETHODCALLTYPE Volume_Init(_In_ CSysTray *pSysTray)
Definition: volume.cpp:141
UINT WPARAM LPARAM lParam
Definition: precomp.h:53
#define WM_MOUSEMOVE
Definition: winuser.h:1741
static BOOL g_IsRunning
Definition: volume.cpp:27
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1747
HRESULT STDMETHODCALLTYPE Volume_Shutdown(_In_ CSysTray *pSysTray)
Definition: volume.cpp:206
static void _ShowContextMenu(CSysTray *pSysTray)
Definition: volume.cpp:231
UINT WPARAM LPARAM LRESULT & lResult
Definition: precomp.h:53
VOID Volume_OnTimer ( HWND  hWnd)

Definition at line 334 of file volume.cpp.

Referenced by CSysTray::ProcessWindowMessage().

335 {
336  TRACE("Volume_OnTimer\n!");
338  _RunVolume(TRUE);
339 }
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
#define TRACE(s)
Definition: solgame.cpp:4
#define VOLUME_TIMER_ID
Definition: precomp.h:87
static void _RunVolume(BOOL bSmall)
Definition: volume.cpp:220
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
HRESULT STDMETHODCALLTYPE Volume_Shutdown ( _In_ CSysTray pSysTray)

Definition at line 206 of file volume.cpp.

Referenced by Volume_Message().

207 {
208  TRACE("Volume_Shutdown\n");
209 
210  g_IsRunning = FALSE;
211 
212  return pSysTray->NotifyIcon(NIM_DELETE, ID_ICON_VOLUME, NULL, NULL);
213 }
#define FALSE
Definition: types.h:117
#define ID_ICON_VOLUME
Definition: precomp.h:43
smooth NULL
Definition: ftsmooth.c:557
#define TRACE(s)
Definition: solgame.cpp:4
#define NIM_DELETE
Definition: shellapi.h:75
static BOOL g_IsRunning
Definition: volume.cpp:27
HRESULT STDMETHODCALLTYPE Volume_Update ( _In_ CSysTray pSysTray)

Definition at line 174 of file volume.cpp.

Referenced by Volume_Message().

175 {
176  BOOL PrevState;
177 
178  TRACE("Volume_Update\n");
179 
180  PrevState = g_IsMute;
181  Volume_IsMute();
182 
183  if (PrevState != g_IsMute)
184  {
185  WCHAR strTooltip[128];
186  HICON icon;
187  if (g_IsMute)
188  {
189  icon = g_hIconMute;
190  LoadStringW(g_hInstance, IDS_VOL_MUTED, strTooltip, _countof(strTooltip));
191  }
192  else
193  {
194  icon = g_hIconVolume;
195  LoadStringW(g_hInstance, IDS_VOL_VOLUME, strTooltip, _countof(strTooltip));
196  }
197 
198  return pSysTray->NotifyIcon(NIM_MODIFY, ID_ICON_VOLUME, icon, strTooltip);
199  }
200  else
201  {
202  return S_OK;
203  }
204 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: fontsub.cpp:30
#define IDS_VOL_VOLUME
Definition: resource.h:32
HRESULT Volume_IsMute(VOID)
Definition: volume.cpp:116
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HICON g_hIconMute
Definition: volume.cpp:17
#define ID_ICON_VOLUME
Definition: precomp.h:43
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL g_IsMute
Definition: volume.cpp:26
#define S_OK
Definition: intsafe.h:59
HICON g_hIconVolume
Definition: volume.cpp:16
#define IDS_VOL_MUTED
Definition: resource.h:36
HINSTANCE g_hInstance
Definition: MainWindow.cpp:18
#define NIM_MODIFY
Definition: shellapi.h:74

Variable Documentation

HINSTANCE g_hInstance

Definition at line 18 of file MainWindow.cpp.

SysTrayIconHandlers_t g_IconHandlers[]

Definition at line 13 of file csystray.cpp.