Leaked source code of windows server 2003
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.

129 lines
3.7 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // Job Scheduler Service
  4. //
  5. // Microsoft Windows
  6. // Copyright (C) Microsoft Corporation, 1992 - 1996.
  7. //
  8. // File: events.hxx
  9. //
  10. // Contents: Idle and battery event notification calls.
  11. //
  12. // History: 22-Mar-96 EricB created
  13. //
  14. //-----------------------------------------------------------------------------
  15. #ifndef __EVENTS_HXX__
  16. #define __EVENTS_HXX__
  17. extern BOOL g_fOnBattery;
  18. typedef struct _IDLESTRUCT {
  19. BOOL fIdleInitialized;
  20. } IDLESTRUCT, * PIDLESTRUCT;
  21. typedef struct _IDLETIMESTRUCT {
  22. DWORD dwStructureSize;
  23. DWORD dwKeyTime;
  24. DWORD dwMouseTime;
  25. DWORD dwOther;
  26. } IDLETIMESTRUCT, * PIDLETIMESTRUCT;
  27. //+----------------------------------------------------------------------------
  28. //
  29. // Function: GetTimeIdle
  30. //
  31. // Synopsis: Obtains the length of time the machine has been idle.
  32. //
  33. //-----------------------------------------------------------------------------
  34. DWORD
  35. GetTimeIdle(void);
  36. //+----------------------------------------------------------------------------
  37. //
  38. // Function: SetNextIdleNotificationFn
  39. //
  40. // Synopsis: Set the length of time to wait for the next idle notification.
  41. //
  42. // Returns: TRUE for success, and FALSE if unable to make the call.
  43. //
  44. //-----------------------------------------------------------------------------
  45. BOOL
  46. SetNextIdleNotificationFn(WORD wIdleWait);
  47. #define SetNextIdleNotification(wIdleWait) \
  48. SendMessage(g_hwndSchedSvc, WM_SCHED_SetNextIdleNotification, wIdleWait, 0)
  49. //+----------------------------------------------------------------------------
  50. //
  51. // Function: SetIdleLossNotificationFn
  52. //
  53. // Synopsis: Registers for idle loss notification.
  54. //
  55. // Returns: TRUE for success, and FALSE if unable to make the call.
  56. //
  57. //-----------------------------------------------------------------------------
  58. BOOL
  59. SetIdleLossNotificationFn();
  60. #define SetIdleLossNotification() \
  61. SendMessage(g_hwndSchedSvc, WM_SCHED_SetIdleLossNotification, 0, 0)
  62. //+----------------------------------------------------------------------------
  63. //
  64. // Function: OnIdleNotification
  65. //
  66. // Synopsis: Called when the winproc receives idle notifications.
  67. //
  68. // Arguments: [wParam] - indicates whether it is for idle start or end.
  69. //
  70. // Returns: hresults
  71. //
  72. //-----------------------------------------------------------------------------
  73. HRESULT
  74. OnIdleNotification(WPARAM wParam);
  75. //+----------------------------------------------------------------------------
  76. //
  77. // Function: InitIdleDetection
  78. //
  79. // Synopsis: Called after the message window is created to initialize idle
  80. // detection.
  81. //
  82. // Arguments:
  83. //
  84. // Returns: hresults
  85. //
  86. //-----------------------------------------------------------------------------
  87. HRESULT
  88. InitIdleDetection();
  89. //+----------------------------------------------------------------------------
  90. //
  91. // Function: EndIdleDetection
  92. //
  93. // Synopsis: Stop idle detection.
  94. //
  95. // Arguments:
  96. //
  97. //-----------------------------------------------------------------------------
  98. void
  99. EndIdleDetection();
  100. //+----------------------------------------------------------------------------
  101. //
  102. // Function: OnPowerChange
  103. //
  104. // Synopsis: Called when the machine's battery state changes.
  105. //
  106. // Arguments: [fGoingOnBattery] - set to true if going on battery power,
  107. // false if going back on line power.
  108. //
  109. // Returns: hresults
  110. //
  111. //-----------------------------------------------------------------------------
  112. HRESULT
  113. OnPowerChange(BOOL fGoingOnBattery);
  114. #endif // __EVENTS_HXX__