ReactOS  0.4.10-dev-348-gbcec1fd
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 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
 
#define HOTPLUG_TIMER_ID   4
 

Typedefs

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

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (stobject)
 
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)
 
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

#define _INC_WINDOWS

Definition at line 10 of file precomp.h.

#define COBJMACROS

Definition at line 8 of file precomp.h.

#define COM_NO_WINDOWS_H

Definition at line 11 of file precomp.h.

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

Definition at line 37 of file precomp.h.

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

Definition at line 38 of file precomp.h.

#define HOTPLUG_TIMER_ID   4

Definition at line 77 of file precomp.h.

Referenced by Hotplug_Message().

#define ID_ICON_HOTPLUG   (WM_APP + 0x4CC)

Definition at line 34 of file precomp.h.

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

#define ID_ICON_POWER   (WM_APP + 0x4CD)

Definition at line 35 of file precomp.h.

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

#define ID_ICON_VOLUME   (WM_APP + 0x4CB)

Definition at line 33 of file precomp.h.

#define NTOS_MODE_USER

Definition at line 12 of file precomp.h.

#define POWER_TIMER_ID   2

Definition at line 75 of file precomp.h.

Referenced by Power_Message().

#define VOLUME_TIMER_ID   3

Definition at line 76 of file precomp.h.

Referenced by Volume_Message().

#define WIN32_NO_STATUS

Definition at line 9 of file precomp.h.

#define WIN32_NO_STATUS

Definition at line 9 of file precomp.h.

Typedef Documentation

Definition at line 45 of file precomp.h.

Definition at line 45 of file precomp.h.

typedef UINT uMsg

Definition at line 45 of file precomp.h.

typedef UINT WPARAM wParam

Definition at line 45 of file precomp.h.

Function Documentation

HRESULT STDMETHODCALLTYPE Hotplug_Init ( _In_ CSysTray pSysTray)

Definition at line 131 of file hotplug.cpp.

Referenced by Hotplug_Message().

132 {
133  TRACE("Hotplug_Init\n");
135  g_IsRunning = TRUE;
137 
138  return pSysTray->NotifyIcon(NIM_ADD, ID_ICON_HOTPLUG, g_hIconHotplug, g_strTooltip, NIS_HIDDEN);
139 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define TRUE
Definition: types.h:120
static HICON g_hIconHotplug
Definition: hotplug.cpp:22
#define ID_ICON_HOTPLUG
Definition: precomp.h:34
static LPCWSTR g_strTooltip
Definition: hotplug.cpp:23
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT EnumHotpluggedDevices(CSimpleArray< DEVINST > &devList)
Definition: hotplug.cpp:39
static BOOL g_IsRunning
Definition: hotplug.cpp:25
CSimpleArray< DEVINST > g_devList
Definition: hotplug.cpp:20
#define NIM_ADD
Definition: shellapi.h:91
#define LoadIcon
Definition: winuser.h:5674
HINSTANCE g_hInstance
Definition: MainWindow.cpp:18
#define IDI_HOTPLUG_OK
Definition: resource.h:56
HRESULT STDMETHODCALLTYPE Hotplug_Message ( _In_ CSysTray pSysTray,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT lResult 
)

Definition at line 240 of file hotplug.cpp.

241 {
242  HRESULT hr = E_FAIL;
243  TRACE("Hotplug_Message uMsg=%d, wParam=%x, lParam=%x\n", uMsg, wParam, lParam);
244 
245  switch (uMsg)
246  {
247  /*case WM_CREATE:
248  TRACE("Hotplug_Message: WM_CREATE\n");
249  DEV_BROADCAST_DEVICEINTERFACE NotificationFilter;
250 
251  ZeroMemory(&NotificationFilter, sizeof(NotificationFilter));
252  NotificationFilter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
253  NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
254 
255  g_hDevNotify = RegisterDeviceNotification(pSysTray->GetHWnd(), &NotificationFilter, DEVICE_NOTIFY_WINDOW_HANDLE | DEVICE_NOTIFY_ALL_INTERFACE_CLASSES);
256  if (g_hDevNotify != NULL)
257  {
258  lResult = true;
259  return S_OK;
260  }
261  return S_FALSE;*/
262 
263  case WM_USER + 220:
264  TRACE("Hotplug_Message: WM_USER+220\n");
265  if (wParam == 1)
266  {
267  if (lParam == FALSE)
268  return Hotplug_Init(pSysTray);
269  else
270  return Hotplug_Shutdown(pSysTray);
271  }
272  return S_FALSE;
273 
274  case WM_USER + 221:
275  TRACE("Hotplug_Message: WM_USER+221\n");
276  if (wParam == 1)
277  {
279  return S_OK;
280  }
281  return S_FALSE;
282 
283  case WM_TIMER:
284  if (wParam == HOTPLUG_TIMER_ID)
285  {
286  KillTimer(pSysTray->GetHWnd(), HOTPLUG_TIMER_ID);
287  _ShowContextMenu(pSysTray);
288  }
289  break;
290 
291  case ID_ICON_HOTPLUG:
292  Hotplug_Update(pSysTray);
293 
294  switch (lParam)
295  {
296  case WM_LBUTTONDOWN:
297  SetTimer(pSysTray->GetHWnd(), HOTPLUG_TIMER_ID, GetDoubleClickTime(), NULL);
298  break;
299 
300  case WM_LBUTTONUP:
301  break;
302 
303  case WM_LBUTTONDBLCLK:
304  KillTimer(pSysTray->GetHWnd(), HOTPLUG_TIMER_ID);
305  _RunHotplug(pSysTray);
306  break;
307 
308  case WM_RBUTTONDOWN:
309  break;
310 
311  case WM_RBUTTONUP:
312  _ShowContextMenuR(pSysTray);
313  break;
314 
315  case WM_RBUTTONDBLCLK:
316  break;
317 
318  case WM_MOUSEMOVE:
319  break;
320  }
321  return S_OK;
322 
323  case WM_DEVICECHANGE:
324  switch (wParam)
325  {
328  if (FAILED(hr))
329  return hr;
330 
331  lResult = true;
332  break;
333  case DBT_DEVICEARRIVAL:
334  break;
336  break;
338  break;
340  WCHAR strInfo[128];
341  swprintf(strInfo, L"The %wS can now be safely removed from the system.", g_strMenuSel);
342  NotifyBalloon(pSysTray, L"Safe to Remove Hardware", strInfo);
343 
344  lResult = true;
345  break;
347  break;
348  }
349  return S_OK;
350 
351  /*case WM_CLOSE:
352  if (!UnregisterDeviceNotification(hDeviceNotify))
353  {
354  return S_FALSE;
355  }
356  return S_OK;*/
357 
358  default:
359  TRACE("Hotplug_Message received for unknown ID %d, ignoring.\n");
360  return S_FALSE;
361  }
362 
363  return S_FALSE;
364 }
static void _RunHotplug(CSysTray *pSysTray)
Definition: hotplug.cpp:160
static void _ShowContextMenu(CSysTray *pSysTray)
Definition: hotplug.cpp:165
#define LRESULT
Definition: msvc.h:49
#define WM_LBUTTONDOWN
Definition: winuser.h:1747
#define DBT_DEVNODES_CHANGED
Definition: dbt.h:28
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ID_ICON_HOTPLUG
Definition: precomp.h:34
UINT uMsg
Definition: precomp.h:45
#define E_FAIL
Definition: ddrawi.h:102
#define FALSE
Definition: types.h:117
#define DBT_DEVICEREMOVECOMPLETE
Definition: dbt.h:16
HRESULT STDMETHODCALLTYPE Hotplug_Init(_In_ CSysTray *pSysTray)
Definition: hotplug.cpp:131
#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:1750
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT STDMETHODCALLTYPE Hotplug_Shutdown(_In_ CSysTray *pSysTray)
Definition: hotplug.cpp:151
LONG HRESULT
Definition: typedefs.h:77
UINT WPARAM wParam
Definition: precomp.h:45
#define WM_TIMER
Definition: winuser.h:1713
#define DBT_DEVICEQUERYREMOVE
Definition: dbt.h:13
HRESULT EnumHotpluggedDevices(CSimpleArray< DEVINST > &devList)
Definition: hotplug.cpp:39
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define WM_RBUTTONUP
Definition: winuser.h:1751
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define DBT_DEVICEQUERYREMOVEFAILED
Definition: dbt.h:14
static const WCHAR L[]
Definition: oid.c:1087
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1749
static BOOL g_IsRunning
Definition: hotplug.cpp:25
#define WM_USER
Definition: winuser.h:1851
#define S_OK
Definition: intsafe.h:59
CSimpleArray< DEVINST > g_devList
Definition: hotplug.cpp:20
static WCHAR g_strMenuSel[DISPLAY_NAME_LEN]
Definition: hotplug.cpp:24
HRESULT STDMETHODCALLTYPE Hotplug_Update(_In_ CSysTray *pSysTray)
Definition: hotplug.cpp:141
#define WM_LBUTTONUP
Definition: winuser.h:1748
#define DBT_DEVICEARRIVAL
Definition: dbt.h:12
UINT WPARAM LPARAM lParam
Definition: precomp.h:45
#define WM_MOUSEMOVE
Definition: winuser.h:1746
#define WM_DEVICECHANGE
Definition: winuser.h:1782
UINT WINAPI GetDoubleClickTime(void)
Definition: ntwrapper.h:314
#define DBT_DEVICEREMOVEPENDING
Definition: dbt.h:15
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1752
#define HOTPLUG_TIMER_ID
Definition: precomp.h:77
HRESULT NotifyBalloon(CSysTray *pSysTray, LPCWSTR szTitle=NULL, LPCWSTR szInfo=NULL, UINT uId=ID_ICON_HOTPLUG)
Definition: hotplug.cpp:101
static void _ShowContextMenuR(CSysTray *pSysTray)
Definition: hotplug.cpp:217
UINT WPARAM LPARAM LRESULT & lResult
Definition: precomp.h:45
HRESULT STDMETHODCALLTYPE Hotplug_Shutdown ( _In_ CSysTray pSysTray)

Definition at line 151 of file hotplug.cpp.

Referenced by Hotplug_Message().

152 {
153  TRACE("Hotplug_Shutdown\n");
154 
155  g_IsRunning = FALSE;
156 
157  return pSysTray->NotifyIcon(NIM_DELETE, ID_ICON_HOTPLUG, NULL, NULL);
158 }
#define ID_ICON_HOTPLUG
Definition: precomp.h:34
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define NIM_DELETE
Definition: shellapi.h:93
static BOOL g_IsRunning
Definition: hotplug.cpp:25
HRESULT STDMETHODCALLTYPE Hotplug_Update ( _In_ CSysTray pSysTray)

Definition at line 141 of file hotplug.cpp.

Referenced by Hotplug_Message().

142 {
143  TRACE("Hotplug_Update\n");
144 
145  if(g_devList.GetSize() || g_IsRemoving)
146  return pSysTray->NotifyIcon(NIM_MODIFY, ID_ICON_HOTPLUG, g_hIconHotplug, g_strTooltip);
147  else
148  return pSysTray->NotifyIcon(NIM_MODIFY, ID_ICON_HOTPLUG, g_hIconHotplug, g_strTooltip, NIS_HIDDEN);
149 }
static HICON g_hIconHotplug
Definition: hotplug.cpp:22
#define ID_ICON_HOTPLUG
Definition: precomp.h:34
static LPCWSTR g_strTooltip
Definition: hotplug.cpp:23
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL g_IsRemoving
Definition: hotplug.cpp:26
CSimpleArray< DEVINST > g_devList
Definition: hotplug.cpp:20
#define NIM_MODIFY
Definition: shellapi.h:92
typedef HRESULT ( STDMETHODCALLTYPE PFNSTINIT)
HRESULT STDMETHODCALLTYPE Power_Init ( _In_ CSysTray pSysTray)

Definition at line 235 of file power.cpp.

Referenced by Power_Message().

236 {
237  TRACE("Power_Init\n");
239  g_IsRunning = TRUE;
240 
241  return pSysTray->NotifyIcon(NIM_ADD, ID_ICON_POWER, g_hIconBattery, g_strTooltip);
242 }
#define TRUE
Definition: types.h:120
static HICON g_hIconBattery
Definition: power.cpp:34
static BOOL g_IsRunning
Definition: power.cpp:35
#define TRACE(s)
Definition: solgame.cpp:4
#define ID_ICON_POWER
Definition: precomp.h:35
static HICON DynamicLoadIcon(HINSTANCE hinst)
Definition: power.cpp:200
#define NIM_ADD
Definition: shellapi.h:91
CString g_strTooltip
Definition: power.cpp:32
HINSTANCE g_hInstance
Definition: MainWindow.cpp:18
HRESULT STDMETHODCALLTYPE Power_Message ( _In_ CSysTray pSysTray,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT lResult 
)

Definition at line 351 of file power.cpp.

352 {
353  TRACE("Power_Message uMsg=%d, wParam=%x, lParam=%x\n", uMsg, wParam, lParam);
354 
355  switch (uMsg)
356  {
357  case WM_USER + 220:
358  TRACE("Power_Message: WM_USER+220\n");
359  if (wParam == 1)
360  {
361  if (lParam == FALSE)
362  return Power_Init(pSysTray);
363  else
364  return Power_Shutdown(pSysTray);
365  }
366  return S_FALSE;
367 
368  case WM_USER + 221:
369  TRACE("Power_Message: WM_USER+221\n");
370  if (wParam == 1)
371  {
373  return S_OK;
374  }
375  return S_FALSE;
376 
377  case WM_TIMER:
378  if (wParam == POWER_TIMER_ID)
379  {
380  KillTimer(pSysTray->GetHWnd(), POWER_TIMER_ID);
381  ShowPowerSchemesPopupMenu(pSysTray);
382  }
383  break;
384 
385  case ID_ICON_POWER:
386  Power_Update(pSysTray);
387 
388  switch (lParam)
389  {
390  case WM_LBUTTONDOWN:
391  SetTimer(pSysTray->GetHWnd(), POWER_TIMER_ID, GetDoubleClickTime(), NULL);
392  break;
393 
394  case WM_LBUTTONUP:
395  break;
396 
397  case WM_LBUTTONDBLCLK:
398  KillTimer(pSysTray->GetHWnd(), POWER_TIMER_ID);
399  _RunPower();
400  break;
401 
402  case WM_RBUTTONDOWN:
403  break;
404 
405  case WM_RBUTTONUP:
406  _ShowContextMenu(pSysTray);
407  break;
408 
409  case WM_RBUTTONDBLCLK:
410  break;
411 
412  case WM_MOUSEMOVE:
413  break;
414  }
415  return S_OK;
416 
417  default:
418  TRACE("Power_Message received for unknown ID %d, ignoring.\n");
419  return S_FALSE;
420  }
421 
422  return S_FALSE;
423 }
HRESULT STDMETHODCALLTYPE Power_Init(_In_ CSysTray *pSysTray)
Definition: power.cpp:235
#define LRESULT
Definition: msvc.h:49
#define WM_LBUTTONDOWN
Definition: winuser.h:1747
HRESULT STDMETHODCALLTYPE Power_Update(_In_ CSysTray *pSysTray)
Definition: power.cpp:244
static void _ShowContextMenu(CSysTray *pSysTray)
Definition: power.cpp:265
UINT uMsg
Definition: precomp.h:45
#define FALSE
Definition: types.h:117
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
static BOOL g_IsRunning
Definition: power.cpp:35
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_RBUTTONDOWN
Definition: winuser.h:1750
#define TRACE(s)
Definition: solgame.cpp:4
#define ID_ICON_POWER
Definition: precomp.h:35
UINT WPARAM wParam
Definition: precomp.h:45
#define WM_TIMER
Definition: winuser.h:1713
#define WM_RBUTTONUP
Definition: winuser.h:1751
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1749
static VOID ShowPowerSchemesPopupMenu(CSysTray *pSysTray)
Definition: power.cpp:316
#define WM_USER
Definition: winuser.h:1851
#define S_OK
Definition: intsafe.h:59
#define POWER_TIMER_ID
Definition: precomp.h:75
#define WM_LBUTTONUP
Definition: winuser.h:1748
UINT WPARAM LPARAM lParam
Definition: precomp.h:45
#define WM_MOUSEMOVE
Definition: winuser.h:1746
UINT WINAPI GetDoubleClickTime(void)
Definition: ntwrapper.h:314
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1752
HRESULT STDMETHODCALLTYPE Power_Shutdown(_In_ CSysTray *pSysTray)
Definition: power.cpp:252
static void _RunPower()
Definition: power.cpp:260
UINT WPARAM LPARAM LRESULT & lResult
Definition: precomp.h:45
HRESULT STDMETHODCALLTYPE Power_Shutdown ( _In_ CSysTray pSysTray)

Definition at line 252 of file power.cpp.

Referenced by Power_Message().

253 {
254  TRACE("Power_Shutdown\n");
255  g_IsRunning = FALSE;
256 
257  return pSysTray->NotifyIcon(NIM_DELETE, ID_ICON_POWER, NULL, NULL);
258 }
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
static BOOL g_IsRunning
Definition: power.cpp:35
#define TRACE(s)
Definition: solgame.cpp:4
#define ID_ICON_POWER
Definition: precomp.h:35
#define NIM_DELETE
Definition: shellapi.h:93
HRESULT STDMETHODCALLTYPE Power_Update ( _In_ CSysTray pSysTray)

Definition at line 244 of file power.cpp.

Referenced by Power_Message().

245 {
246  TRACE("Power_Update\n");
248 
249  return pSysTray->NotifyIcon(NIM_MODIFY, ID_ICON_POWER, g_hIconBattery, g_strTooltip);
250 }
static HICON g_hIconBattery
Definition: power.cpp:34
#define TRACE(s)
Definition: solgame.cpp:4
#define ID_ICON_POWER
Definition: precomp.h:35
static HICON DynamicLoadIcon(HINSTANCE hinst)
Definition: power.cpp:200
CString g_strTooltip
Definition: power.cpp:32
HINSTANCE g_hInstance
Definition: MainWindow.cpp:18
#define NIM_MODIFY
Definition: shellapi.h:92
HRESULT STDMETHODCALLTYPE Volume_Init ( _In_ CSysTray pSysTray)

Definition at line 138 of file volume.cpp.

Referenced by Volume_Message().

139 {
140  HRESULT hr;
141  WCHAR strTooltip[128];
142 
143  TRACE("Volume_Init\n");
144 
145  if (!g_hMixer)
146  {
147  hr = Volume_FindMixerControl(pSysTray);
148  if (FAILED(hr))
149  return hr;
150 
151  g_mmDeviceChange = RegisterWindowMessageW(L"winmm_devicechange");
152  }
153 
156 
157  Volume_IsMute();
158 
159  g_IsRunning = TRUE;
160 
161  HICON icon;
162  if (g_IsMute)
163  icon = g_hIconMute;
164  else
165  icon = g_hIconVolume;
166 
167  LoadStringW(g_hInstance, IDS_VOL_VOLUME, strTooltip, _countof(strTooltip));
168  return pSysTray->NotifyIcon(NIM_ADD, ID_ICON_VOLUME, icon, strTooltip);
169 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
static HICON
Definition: imagelist.c:84
#define IDI_VOLMUTE
Definition: resource.h:30
#define TRUE
Definition: types.h:120
HRESULT Volume_IsMute()
Definition: volume.cpp:113
__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:21
static HRESULT __stdcall Volume_FindMixerControl(CSysTray *pSysTray)
Definition: volume.cpp:26
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:32
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static BOOL g_IsMute
Definition: volume.cpp:23
static const WCHAR L[]
Definition: oid.c:1087
UINT WINAPI RegisterWindowMessageW(_In_ LPCWSTR)
HICON g_hIconVolume
Definition: volume.cpp:13
#define NIM_ADD
Definition: shellapi.h:91
static BOOL g_IsRunning
Definition: volume.cpp:24
HMIXER g_hMixer
Definition: volume.cpp:16
#define LoadIcon
Definition: winuser.h:5674
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 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");
269  if (wParam == 4)
270  {
271  if (lParam == FALSE)
272  return Volume_Init(pSysTray);
273  else
274  return Volume_Shutdown(pSysTray);
275  }
276  return S_FALSE;
277 
278  case WM_USER + 221:
279  TRACE("Volume_Message: WM_USER+221\n");
280  if (wParam == 4)
281  {
283  return S_OK;
284  }
285  return S_FALSE;
286 
287  case WM_TIMER:
288  if (wParam == VOLUME_TIMER_ID)
289  {
290  KillTimer(pSysTray->GetHWnd(), VOLUME_TIMER_ID);
291  _RunVolume(TRUE);
292  }
293  break;
294 
295  case ID_ICON_VOLUME:
296  TRACE("Volume_Message uMsg=%d, w=%x, l=%x\n", uMsg, wParam, lParam);
297 
298  Volume_Update(pSysTray);
299 
300  switch (lParam)
301  {
302  case WM_LBUTTONDOWN:
303  SetTimer(pSysTray->GetHWnd(), VOLUME_TIMER_ID, GetDoubleClickTime(), NULL);
304  break;
305 
306  case WM_LBUTTONUP:
307  break;
308 
309  case WM_LBUTTONDBLCLK:
310  KillTimer(pSysTray->GetHWnd(), VOLUME_TIMER_ID);
311  _RunVolume(FALSE);
312  break;
313 
314  case WM_RBUTTONDOWN:
315  break;
316 
317  case WM_RBUTTONUP:
318  _ShowContextMenu(pSysTray);
319  break;
320 
321  case WM_RBUTTONDBLCLK:
322  break;
323 
324  case WM_MOUSEMOVE:
325  break;
326  }
327  return S_OK;
328 
329  default:
330  TRACE("Volume_Message received for unknown ID %d, ignoring.\n");
331  return S_FALSE;
332  }
333 
334  return S_FALSE;
335 }
#define TRUE
Definition: types.h:120
#define LRESULT
Definition: msvc.h:49
#define WM_LBUTTONDOWN
Definition: winuser.h:1747
UINT uMsg
Definition: precomp.h:45
UINT g_mmDeviceChange
Definition: volume.cpp:21
#define FALSE
Definition: types.h:117
HRESULT STDMETHODCALLTYPE Volume_Update(_In_ CSysTray *pSysTray)
Definition: volume.cpp:171
#define ID_ICON_VOLUME
Definition: precomp.h:32
#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:1750
#define TRACE(s)
Definition: solgame.cpp:4
#define VOLUME_TIMER_ID
Definition: precomp.h:76
UINT WPARAM wParam
Definition: precomp.h:45
#define WM_TIMER
Definition: winuser.h:1713
HRESULT Volume_OnDeviceChange(_In_ CSysTray *pSysTray, WPARAM wParam, LPARAM lParam)
Definition: volume.cpp:212
#define WM_RBUTTONUP
Definition: winuser.h:1751
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
static void _RunVolume(BOOL bTray)
Definition: volume.cpp:217
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1749
#define WM_USER
Definition: winuser.h:1851
#define S_OK
Definition: intsafe.h:59
#define WM_LBUTTONUP
Definition: winuser.h:1748
HRESULT STDMETHODCALLTYPE Volume_Init(_In_ CSysTray *pSysTray)
Definition: volume.cpp:138
UINT WPARAM LPARAM lParam
Definition: precomp.h:45
#define WM_MOUSEMOVE
Definition: winuser.h:1746
static BOOL g_IsRunning
Definition: volume.cpp:24
UINT WINAPI GetDoubleClickTime(void)
Definition: ntwrapper.h:314
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1752
HRESULT STDMETHODCALLTYPE Volume_Shutdown(_In_ CSysTray *pSysTray)
Definition: volume.cpp:203
static void _ShowContextMenu(CSysTray *pSysTray)
Definition: volume.cpp:227
UINT WPARAM LPARAM LRESULT & lResult
Definition: precomp.h:45
HRESULT STDMETHODCALLTYPE Volume_Shutdown ( _In_ CSysTray pSysTray)

Definition at line 203 of file volume.cpp.

Referenced by Volume_Message().

204 {
205  TRACE("Volume_Shutdown\n");
206 
207  g_IsRunning = FALSE;
208 
209  return pSysTray->NotifyIcon(NIM_DELETE, ID_ICON_VOLUME, NULL, NULL);
210 }
#define FALSE
Definition: types.h:117
#define ID_ICON_VOLUME
Definition: precomp.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define NIM_DELETE
Definition: shellapi.h:93
static BOOL g_IsRunning
Definition: volume.cpp:24
HRESULT STDMETHODCALLTYPE Volume_Update ( _In_ CSysTray pSysTray)

Definition at line 171 of file volume.cpp.

Referenced by Volume_Message().

172 {
173  BOOL PrevState;
174 
175  TRACE("Volume_Update\n");
176 
177  PrevState = g_IsMute;
178  Volume_IsMute();
179 
180  if (PrevState != g_IsMute)
181  {
182  WCHAR strTooltip[128];
183  HICON icon;
184  if (g_IsMute)
185  {
186  icon = g_hIconMute;
187  LoadStringW(g_hInstance, IDS_VOL_MUTED, strTooltip, _countof(strTooltip));
188  }
189  else
190  {
191  icon = g_hIconVolume;
192  LoadStringW(g_hInstance, IDS_VOL_VOLUME, strTooltip, _countof(strTooltip));
193  }
194 
195  return pSysTray->NotifyIcon(NIM_MODIFY, ID_ICON_VOLUME, icon, strTooltip);
196  }
197  else
198  {
199  return S_OK;
200  }
201 }
static HICON
Definition: imagelist.c:84
HRESULT Volume_IsMute()
Definition: volume.cpp:113
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: fontsub.cpp:30
#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
#define ID_ICON_VOLUME
Definition: precomp.h:32
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
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
WINE_DEFAULT_DEBUG_CHANNEL ( stobject  )

Variable Documentation

HINSTANCE g_hInstance

Definition at line 18 of file MainWindow.cpp.

SysTrayIconHandlers_t g_IconHandlers[]

Definition at line 15 of file csystray.cpp.