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