Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
2.9 KiB

  1. /*******************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORP., 1993-1994
  4. *
  5. * TITLE: SYSTRAY.H
  6. *
  7. * VERSION: 2.1
  8. *
  9. * AUTHOR: Tracy Sharpe / RAL
  10. *
  11. * DATE: 20 Feb 1994
  12. *
  13. * Public definitions of the system tray applet (battery meter, PCMCIA, etc).
  14. *
  15. ********************************************************************************
  16. *
  17. * CHANGE LOG:
  18. *
  19. * DATE REV DESCRIPTION
  20. * ----------- --- -------------------------------------------------------------
  21. * 20 Feb 1994 TCS Original implementation.
  22. * 11/8/94 RAL Converted to systray
  23. * 10/23/95 Shawnb Unicode enabled
  24. *
  25. *******************************************************************************/
  26. #ifndef _INC_SYSTRAY
  27. #define _INC_SYSTRAY
  28. #define SYSTRAY_CLASSNAME TEXT ("SystemTray_Main")
  29. // Private tray icon notification message sent to the BatteryMeter window.
  30. #define STWM_NOTIFYPOWER (WM_USER + 201)
  31. #define STWM_NOTIFYPCMCIA (WM_USER + 202)
  32. #define STWM_NOTIFYVOLUME (WM_USER + 203)
  33. #define STWM_NOTIFYSTICKYKEYS (WM_USER + 204)
  34. #define STWM_NOTIFYMOUSEKEYS (WM_USER + 205)
  35. #define STWM_NOTIFYFILTERKEYS (WM_USER + 206)
  36. #define STWM_NOTIFYCSC (WM_USER + 207)
  37. #define STWM_NOTIFYUSBUI (WM_USER + 208)
  38. // Private tray icon notification messages sent to the BatteryMeter window.
  39. #define STWM_ENABLESERVICE (WM_USER + 220)
  40. #define STWM_GETSTATE (WM_USER + 221)
  41. #define STSERVICE_POWER 1
  42. #define STSERVICE_PCMCIA 2
  43. #define STSERVICE_VOLUME 4
  44. #define STSERVICE_CSC 8
  45. #define STSERVICE_USBUI 16
  46. #define STSERVICE_ALL 31 // Internal
  47. //
  48. // Flags for the PCMCIA registry entry
  49. //
  50. #define PCMCIA_REGFLAG_NOWARN 1
  51. // Prototypes
  52. _inline BOOL SysTray_EnableService(int idSTService, BOOL fEnable)
  53. {
  54. HWND hwndST = FindWindow(SYSTRAY_CLASSNAME, NULL);
  55. if (hwndST)
  56. {
  57. SendMessage(hwndST, STWM_ENABLESERVICE, idSTService, fEnable);
  58. return TRUE;
  59. }
  60. else
  61. {
  62. if (fEnable)
  63. {
  64. static const TCHAR szOPEN[] = TEXT ("open");
  65. static const TCHAR szFILE[] = TEXT ("SYSTRAY.EXE");
  66. static const TCHAR szFORMAT[] = TEXT ("%i");
  67. TCHAR szPARAMS[10];
  68. HINSTANCE hInst;
  69. wsprintf (szPARAMS, szFORMAT, idSTService);
  70. hInst = ShellExecute (NULL, szOPEN, szFILE,
  71. szPARAMS, NULL, SW_SHOWNOACTIVATE);
  72. if (hInst <= (HINSTANCE)32)
  73. return FALSE;
  74. }
  75. return TRUE;
  76. }
  77. } // End SysTray_EnableService
  78. _inline BOOL SysTray_IsServiceEnabled(WPARAM idSTService)
  79. {
  80. HWND hwndST = FindWindow(SYSTRAY_CLASSNAME, NULL);
  81. if (hwndST)
  82. {
  83. return((BOOL)SendMessage(hwndST, STWM_GETSTATE, idSTService, 0));
  84. }
  85. else
  86. {
  87. return (FALSE);
  88. }
  89. } // End SysTray_IsServiceEnabled
  90. #endif // _INC_SYSTRAY