1.查询电源状态
This function retrieves battery status information.
DWORD GetSystemPowerStatusEx2( PSYSTEM_POWER_STATUS_EX2 pSystemPowerStatusEx2, DWORD dwLen, BOOL fUpdate );
Parameters
-
pSystemPowerStatusEx2
- [out] Pointer to a buffer that receives power status information. dwLen
- [in] Specifies the length of the buffer pointed to by pSystemPowerStatusEx2. fUpdate
- [in] Specify TRUE to get the latest information from the device driver. Specify FALSE to get cached information that may be out-of-date by several seconds.
Return Values
Length of the data returned in the pSystemPowerStatusEx2 buffer indicates success. Zero indicates failure.
2.电源管理器
1)电源通知
RequestPowerNotifications()
2)设置电源状态
SetSystemPowerState();
SetPowerRequirement();
3.不使用 电源管理器来管理电源
1)关闭电源 GwesPowerOffSystem();