ReactOS  0.4.15-dev-309-g7c8d563
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 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)
 

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 80 of file precomp.h.

◆ HOTPLUG_SERVICE_FLAG

#define HOTPLUG_SERVICE_FLAG   0x00000002

Definition at line 38 of file precomp.h.

◆ HOTPLUG_TIMER_ID

#define HOTPLUG_TIMER_ID   4

Definition at line 79 of file precomp.h.

◆ ID_ICON_HOTPLUG

#define ID_ICON_HOTPLUG   (WM_APP + 0x4CC)

Definition at line 34 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 37 of file precomp.h.

◆ POWER_TIMER_ID

#define POWER_TIMER_ID   2

Definition at line 77 of file precomp.h.

◆ VOLUME_SERVICE_FLAG

#define VOLUME_SERVICE_FLAG   0x00000004

Definition at line 39 of file precomp.h.

◆ VOLUME_TIMER_ID

#define VOLUME_TIMER_ID   3

Definition at line 78 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 43 of file precomp.h.

◆ PFNSTMESSAGE

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

Definition at line 46 of file precomp.h.

◆ PFNSTSHUTDOWN

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

Definition at line 44 of file precomp.h.

◆ PFNSTUPDATE

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

Definition at line 45 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 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDS_HOTPLUG_REMOVE_1
Definition: resource.h:18
static HICON g_hIconHotplug
Definition: hotplug.cpp:20
#define ID_ICON_HOTPLUG
Definition: precomp.h:34
#define TRACE(s)
Definition: solgame.cpp:4
CString g_strHotplugTooltip
Definition: hotplug.cpp:19
HRESULT EnumHotpluggedDevices(CSimpleArray< DEVINST > &devList)
Definition: hotplug.cpp:35
CSimpleArray< DEVINST > g_devList
Definition: hotplug.cpp:18
#define NIM_ADD
Definition: shellapi.h:91
#define LoadIcon
Definition: winuser.h:5788
HINSTANCE g_hInstance
Definition: MainWindow.cpp:18
#define IDI_HOTPLUG_OK
Definition: resource.h:57

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:
291  if (wParam == HOTPLUG_TIMER_ID)
292  {
293  KillTimer(pSysTray->GetHWnd(), HOTPLUG_TIMER_ID);
294  _ShowContextMenu(pSysTray);
295  }
296  else if (wParam == HOTPLUG_DEVICE_TIMER_ID)
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 
342  case DBT_DEVICEARRIVAL:
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 }
#define HOTPLUG_SERVICE_FLAG
Definition: precomp.h:38
static void _RunHotplug(CSysTray *pSysTray)
Definition: hotplug.cpp:155
static void _ShowContextMenu(CSysTray *pSysTray)
Definition: hotplug.cpp:165
#define TRUE
Definition: types.h:120
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
#define DBT_DEVNODES_CHANGED
Definition: dbt.h:28
#define ID_ICON_HOTPLUG
Definition: precomp.h:34
WPARAM wParam
Definition: combotst.c:138
#define DBT_DEVICEREMOVECOMPLETE
Definition: dbt.h:16
HRESULT STDMETHODCALLTYPE Hotplug_Init(_In_ CSysTray *pSysTray)
Definition: hotplug.cpp:124
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define HOTPLUG_DEVICE_TIMER_ID
Definition: precomp.h:80
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_RBUTTONDOWN
Definition: winuser.h:1761
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT STDMETHODCALLTYPE Hotplug_Shutdown(_In_ CSysTray *pSysTray)
Definition: hotplug.cpp:145
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_TIMER
Definition: winuser.h:1724
#define DBT_DEVICEQUERYREMOVE
Definition: dbt.h:13
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define WM_RBUTTONUP
Definition: winuser.h:1762
VOID HotplugDeviceTimer(_In_ CSysTray *pSysTray)
Definition: hotplug.cpp:244
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define DBT_DEVICEQUERYREMOVEFAILED
Definition: dbt.h:14
static const WCHAR L[]
Definition: oid.c:1250
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1760
#define LRESULT
Definition: ole.h:14
#define WM_USER
Definition: winuser.h:1877
#define S_OK
Definition: intsafe.h:59
static WCHAR g_strMenuSel[DISPLAY_NAME_LEN]
Definition: hotplug.cpp:21
#define WM_LBUTTONUP
Definition: winuser.h:1759
#define DBT_DEVICEARRIVAL
Definition: dbt.h:12
#define WM_MOUSEMOVE
Definition: winuser.h:1757
#define WM_DEVICECHANGE
Definition: winuser.h:1793
UINT WINAPI GetDoubleClickTime(void)
Definition: ntwrapper.h:314
#define DBT_DEVICEREMOVEPENDING
Definition: dbt.h:15
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1763
#define HOTPLUG_TIMER_ID
Definition: precomp.h:79
HRESULT NotifyBalloon(CSysTray *pSysTray, LPCWSTR szTitle=NULL, LPCWSTR szInfo=NULL, UINT uId=ID_ICON_HOTPLUG)
Definition: hotplug.cpp:94
LPARAM lParam
Definition: combotst.c:139
static void _ShowContextMenuR(CSysTray *pSysTray)
Definition: hotplug.cpp:218

◆ 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 }
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
static HICON g_hIconHotplug
Definition: hotplug.cpp:20
#define ID_ICON_HOTPLUG
Definition: precomp.h:34
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define NIM_DELETE
Definition: shellapi.h:93

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 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ 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
#define TRACE(s)
Definition: solgame.cpp:4
#define ID_ICON_POWER
Definition: precomp.h:35
static HICON DynamicLoadIcon(HINSTANCE hinst)
Definition: power.cpp:77
#define NIM_ADD
Definition: shellapi.h:91
CString g_strTooltip
Definition: power.cpp:29
HINSTANCE g_hInstance
Definition: MainWindow.cpp:18

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");
238  if (wParam == POWER_SERVICE_FLAG)
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");
255  if (wParam == POWER_SERVICE_FLAG)
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);
266  ShowPowerSchemesPopupMenu(pSysTray);
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 }
#define POWER_SERVICE_FLAG
Definition: precomp.h:37
HRESULT STDMETHODCALLTYPE Power_Init(_In_ CSysTray *pSysTray)
Definition: power.cpp:115
#define TRUE
Definition: types.h:120
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
HRESULT STDMETHODCALLTYPE Power_Update(_In_ CSysTray *pSysTray)
Definition: power.cpp:123
static void _ShowContextMenu(CSysTray *pSysTray)
Definition: power.cpp:143
WPARAM wParam
Definition: combotst.c:138
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_RBUTTONDOWN
Definition: winuser.h:1761
#define TRACE(s)
Definition: solgame.cpp:4
#define ID_ICON_POWER
Definition: precomp.h:35
#define WM_TIMER
Definition: winuser.h:1724
#define WM_RBUTTONUP
Definition: winuser.h:1762
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1760
#define LRESULT
Definition: ole.h:14
static VOID ShowPowerSchemesPopupMenu(CSysTray *pSysTray)
Definition: power.cpp:195
#define WM_USER
Definition: winuser.h:1877
#define S_OK
Definition: intsafe.h:59
#define POWER_TIMER_ID
Definition: precomp.h:77
#define WM_LBUTTONUP
Definition: winuser.h:1759
#define WM_MOUSEMOVE
Definition: winuser.h:1757
UINT WINAPI GetDoubleClickTime(void)
Definition: ntwrapper.h:314
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1763
HRESULT STDMETHODCALLTYPE Power_Shutdown(_In_ CSysTray *pSysTray)
Definition: power.cpp:131
LPARAM lParam
Definition: combotst.c:139
static void _RunPower()
Definition: power.cpp:138

◆ 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 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define ID_ICON_POWER
Definition: precomp.h:35
#define NIM_DELETE
Definition: shellapi.h:93

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 }
static HICON g_hIconBattery
Definition: power.cpp:30
#define TRACE(s)
Definition: solgame.cpp:4
#define ID_ICON_POWER
Definition: precomp.h:35
static HICON DynamicLoadIcon(HINSTANCE hinst)
Definition: power.cpp:77
CString g_strTooltip
Definition: power.cpp:29
HINSTANCE g_hInstance
Definition: MainWindow.cpp:18
#define NIM_MODIFY
Definition: shellapi.h:92

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 
156  Volume_IsMute();
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 MAKEINTRESOURCE
Definition: winuser.h:591
static HICON
Definition: imagelist.c:84
#define IDI_VOLMUTE
Definition: resource.h:30
HRESULT hr
Definition: shlfolder.c:183
HRESULT Volume_IsMute()
Definition: volume.cpp:112
#define IDS_VOL_VOLUME
Definition: resource.h:32
UINT g_mmDeviceChange
Definition: volume.cpp:21
static HRESULT __stdcall Volume_FindMixerControl(CSysTray *pSysTray)
Definition: volume.cpp:25
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:14
#define ID_ICON_VOLUME
Definition: precomp.h:38
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
#define _countof(array)
Definition: sndvol32.h:68
static BOOL g_IsMute
Definition: volume.cpp:23
static const WCHAR L[]
Definition: oid.c:1250
UINT WINAPI RegisterWindowMessageW(_In_ LPCWSTR)
HICON g_hIconVolume
Definition: volume.cpp:13
#define NIM_ADD
Definition: shellapi.h:91
HMIXER g_hMixer
Definition: volume.cpp:16
#define LoadIcon
Definition: winuser.h:5788
HINSTANCE g_hInstance
Definition: MainWindow.cpp:18
#define IDI_VOLUME
Definition: resource.h:29

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);
298  _RunVolume(TRUE);
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);
318  _RunVolume(FALSE);
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 TRUE
Definition: types.h:120
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
UINT g_mmDeviceChange
Definition: volume.cpp:21
WPARAM wParam
Definition: combotst.c:138
HRESULT STDMETHODCALLTYPE Volume_Update(_In_ CSysTray *pSysTray)
Definition: volume.cpp:168
#define ID_ICON_VOLUME
Definition: precomp.h:38
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_RBUTTONDOWN
Definition: winuser.h:1761
#define TRACE(s)
Definition: solgame.cpp:4
#define VOLUME_TIMER_ID
Definition: precomp.h:78
#define VOLUME_SERVICE_FLAG
Definition: precomp.h:39
#define WM_TIMER
Definition: winuser.h:1724
HRESULT Volume_OnDeviceChange(_In_ CSysTray *pSysTray, WPARAM wParam, LPARAM lParam)
Definition: volume.cpp:207
#define WM_RBUTTONUP
Definition: winuser.h:1762
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
static void _RunVolume(BOOL bTray)
Definition: volume.cpp:212
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1760
#define LRESULT
Definition: ole.h:14
#define WM_USER
Definition: winuser.h:1877
#define S_OK
Definition: intsafe.h:59
#define WM_LBUTTONUP
Definition: winuser.h:1759
HRESULT STDMETHODCALLTYPE Volume_Init(_In_ CSysTray *pSysTray)
Definition: volume.cpp:137
#define WM_MOUSEMOVE
Definition: winuser.h:1757
UINT WINAPI GetDoubleClickTime(void)
Definition: ntwrapper.h:314
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1763
HRESULT STDMETHODCALLTYPE Volume_Shutdown(_In_ CSysTray *pSysTray)
Definition: volume.cpp:200
static void _ShowContextMenu(CSysTray *pSysTray)
Definition: volume.cpp:227
LPARAM lParam
Definition: combotst.c:139

◆ 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 }
#define ID_ICON_VOLUME
Definition: precomp.h:38
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define NIM_DELETE
Definition: shellapi.h:93

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;
175  Volume_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 }
static HICON
Definition: imagelist.c:84
HRESULT Volume_IsMute()
Definition: volume.cpp:112
#define IDS_VOL_VOLUME
Definition: resource.h:32
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:14
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ID_ICON_VOLUME
Definition: precomp.h:38
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
static BOOL g_IsMute
Definition: volume.cpp:23
#define S_OK
Definition: intsafe.h:59
HICON g_hIconVolume
Definition: volume.cpp:13
#define IDS_VOL_MUTED
Definition: resource.h:36
HINSTANCE g_hInstance
Definition: MainWindow.cpp:18
#define NIM_MODIFY
Definition: shellapi.h:92

Referenced by Volume_Message().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( stobject  )

Variable Documentation

◆ g_hInstance

HINSTANCE g_hInstance

Definition at line 18 of file MainWindow.cpp.

◆ g_IconHandlers

◆ g_NumIcons