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.

113 lines
4.6 KiB

  1. /*******************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORP., 1993-1994
  4. *
  5. * TITLE: BATMETER.H
  6. *
  7. * VERSION: 2.0
  8. *
  9. * AUTHOR: ReedB
  10. *
  11. * DATE: 31 Dec 1993
  12. *
  13. *
  14. *******************************************************************************/
  15. // Private BatMeter window message.
  16. #define WM_DESTROYBATMETER WM_USER+100
  17. #ifndef ARRAYSIZE
  18. #define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
  19. #endif
  20. // This structure encapsulates what is displayed for each battery
  21. // and the composite system.
  22. typedef struct _BATTERY_STATE{
  23. ULONG ulSize; // Size of structure.
  24. struct _BATTERY_STATE *bsNext; // Next in list
  25. struct _BATTERY_STATE *bsPrev; // Previous in list
  26. ULONG ulBatNum; // Display battery number.
  27. ULONG ulTag; // Zero implies no battery.
  28. HANDLE hDevice; // Handle to the battery device.
  29. #ifdef WINNT
  30. HDEVNOTIFY hDevNotify; // Device notification handle.
  31. #endif
  32. UINT uiIconIDcache; // Cache of the last Icon ID.
  33. HICON hIconCache; // Cache of the last Icon handle.
  34. HICON hIconCache16; // As above but 16x16.
  35. LPTSTR lpszDeviceName; // The name of the battery device
  36. ULONG ulFullChargedCapacity; // Same as PBATTERY_INFORMATION->FullChargedCapacity.
  37. ULONG ulPowerState; // Same flags as PBATTERY_STATUS->PowerState.
  38. ULONG ulBatLifePercent; // Battery life remaining as percentage.
  39. ULONG ulBatLifeTime; // Battery life remaining as time in seconds.
  40. ULONG ulLastTag; // Previous value of ulTag.
  41. ULONG ulLastPowerState; // Previous value of ulPowerState.
  42. ULONG ulLastBatLifePercent; // Previous value of ulBatLifePercent.
  43. ULONG ulLastBatLifeTime; // Previous value of ulBatLifeTime.
  44. } BATTERY_STATE, *PBATTERY_STATE;
  45. // Power management UI help file:
  46. #define PWRMANHLP TEXT("PWRMN.HLP")
  47. // Number of batteries that battery meter can display.
  48. #define NUM_BAT 8
  49. #define BATTERY_RELATED_FLAGS (BATTERY_FLAG_HIGH | BATTERY_FLAG_LOW | BATTERY_FLAG_CRITICAL | BATTERY_FLAG_CHARGING | BATTERY_FLAG_NO_BATTERY)
  50. // Public function prototypes:
  51. BOOL PowerCapabilities();
  52. BOOL BatMeterCapabilities(PUINT*);
  53. BOOL UpdateBatMeter(HWND, BOOL, BOOL, PBATTERY_STATE);
  54. HWND CreateBatMeter(HWND, HWND, BOOL, PBATTERY_STATE);
  55. HWND DestroyBatMeter(HWND);
  56. // DisplayFreeStr bFree parameters:
  57. #define FREE_STR TRUE
  58. #define NO_FREE_STR FALSE
  59. // Private functions implemented in BATMETER.C
  60. LPTSTR CDECL LoadDynamicString( UINT StringID, ... );
  61. LPTSTR DisplayFreeStr(HWND, UINT, LPTSTR, BOOL);
  62. LRESULT CALLBACK BatMeterDlgProc(HWND, UINT, WPARAM, LPARAM);
  63. BOOL SwitchDisplayMode(HWND, BOOL);
  64. BOOL UpdateBatMeterProc(PBATTERY_STATE, HWND, LPARAM, LPARAM);
  65. UINT GetBatteryDriverNames(LPTSTR*);
  66. BOOL UpdateDriverList(LPTSTR*, UINT);
  67. VOID FreeBatteryDriverNames(LPTSTR*);
  68. UINT MapBatInfoToIconID(PBATTERY_STATE);
  69. HICON PASCAL GetBattIcon(HWND, UINT, HICON, BOOL, UINT);
  70. // Private functions implemented in DETAILS.C
  71. LRESULT CALLBACK BatDetailDlgProc(HWND, UINT, WPARAM, LPARAM);
  72. // WalkBatteryState pbsStart parameters:
  73. #define ALL &g_bs
  74. #define DEVICES g_bs.bsNext
  75. // WalkBatteryState enum proc declaration.
  76. typedef LRESULT (CALLBACK *WALKENUMPROC)(PBATTERY_STATE, HWND, LPARAM, LPARAM);
  77. // RemoveMissingProc lParam2 parameters:
  78. #define REMOVE_MISSING 0
  79. #define REMOVE_ALL 1
  80. // Private functions implemented in BATSTATE.C
  81. BOOL WalkBatteryState(PBATTERY_STATE, WALKENUMPROC, HWND, LPARAM, LPARAM);
  82. BOOL RemoveBatteryStateDevice(PBATTERY_STATE);
  83. BOOL RemoveMissingProc(PBATTERY_STATE, HWND, LPARAM, LPARAM);
  84. BOOL FindNameProc(PBATTERY_STATE, HWND, LPARAM, LPARAM);
  85. BOOL UpdateBatInfoProc(PBATTERY_STATE, HWND, LPARAM, LPARAM);
  86. BOOL SimUpdateBatInfoProc(PBATTERY_STATE, HWND, LPARAM, LPARAM);
  87. void SystemPowerStatusToBatteryState(LPSYSTEM_POWER_STATUS, PBATTERY_STATE);
  88. PBATTERY_STATE AddBatteryStateDevice(LPTSTR, ULONG);
  89. PBATTERY_STATE SimAddBatteryStateDevice(LPTSTR, ULONG);
  90. #ifdef DBG
  91. #define BATTRACE(_ARGS) DbgPrint _ARGS
  92. #else
  93. #define BATTRACE
  94. #endif