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.

97 lines
2.5 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. *
  24. *******************************************************************************/
  25. #ifndef _INC_SYSTRAY
  26. #define _INC_SYSTRAY
  27. #define SYSTRAY_CLASSNAME TEXT("SystemTray_Main")
  28. // Private tray icon notification message sent to the BatteryMeter window.
  29. #define STWM_NOTIFYPOWER (WM_USER + 201)
  30. #define STWM_NOTIFYPCMCIA (WM_USER + 202)
  31. #define STWM_NOTIFYVOLUME (WM_USER + 203)
  32. // Private tray icon notification messages sent to the BatteryMeter window.
  33. #define STWM_ENABLESERVICE (WM_USER + 220)
  34. #define STWM_GETSTATE (WM_USER + 221)
  35. _inline BOOL SysTray_EnableService(int idSTService, BOOL fEnable)
  36. {
  37. if (fEnable)
  38. {
  39. STARTUPINFO si;
  40. PROCESS_INFORMATION pi;
  41. static const TCHAR szSTExecFmt[] = TEXT("SYSTRAY.EXE %i");
  42. TCHAR szEnableCmd[sizeof(szSTExecFmt)+10];
  43. memset(&si, 0, sizeof(si));
  44. si.cb = sizeof(si);
  45. si.wShowWindow = SW_SHOWNOACTIVATE;
  46. si.dwFlags = STARTF_USESHOWWINDOW;
  47. wsprintf(szEnableCmd, szSTExecFmt, idSTService);
  48. if (CreateProcess(NULL,szEnableCmd,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi))
  49. {
  50. CloseHandle(pi.hProcess);
  51. CloseHandle(pi.hThread);
  52. return TRUE;
  53. }
  54. else
  55. {
  56. return FALSE;
  57. }
  58. }
  59. else
  60. {
  61. HWND hwndST = FindWindow(SYSTRAY_CLASSNAME, NULL);
  62. if (hwndST)
  63. {
  64. SendMessage(hwndST, STWM_ENABLESERVICE, idSTService, FALSE);
  65. }
  66. }
  67. return TRUE;
  68. }
  69. _inline BOOL SysTray_IsServiceEnabled(WPARAM idSTService)
  70. {
  71. HWND hwndST = FindWindow(SYSTRAY_CLASSNAME, NULL);
  72. if (hwndST) {
  73. return((BOOL)SendMessage(hwndST, STWM_GETSTATE, idSTService, 0));
  74. } else {
  75. return(FALSE);
  76. }
  77. }
  78. #define STSERVICE_POWER 1
  79. #define STSERVICE_PCMCIA 2
  80. #define STSERVICE_VOLUME 4
  81. #define STSERVICE_ALL 7 // Internal
  82. //
  83. // Flags for the PCMCIA registry entry
  84. //
  85. #define PCMCIA_REGFLAG_NOWARN 1
  86. #endif // _INC_SYSTRAY