Показать сообщение отдельно
Старый 16.04.2008, 09:16
alexcon314 вне форума Посмотреть профиль Отправить личное сообщение для alexcon314 Найти все сообщения от alexcon314
  № 2  
Ответить с цитированием
alexcon314
listener

модератор форума
Регистрация: Jun 2006
Сообщений: 3,260
Записей в блоге: 28
Отправить сообщение для alexcon314 с помощью ICQ
надо воспользоваться Win32 API
Код:
The GetSystemPowerStatus function retrieves the power status of the system. The status indicates whether the system is running on AC or DC power, whether the battery is currently charging, and how much battery life remains.


BOOL GetSystemPowerStatus(
  LPSYSTEM_POWER_STATUS lpSystemPowerStatus
);

Parameters
lpSystemPowerStatus 
[out] Pointer to a SYSTEM_POWER_STATUS structure that receives status information. 

SYSTEM_POWER_STATUS

The SYSTEM_POWER_STATUS structure contains information about the power status of the system.


typedef struct _SYSTEM_POWER_STATUS {  
 BYTE ACLineStatus;  
 BYTE BatteryFlag; 
 BYTE BatteryLifePercent;  
 BYTE Reserved1;  
 DWORD BatteryLifeTime;  
 DWORD BatteryFullLifeTime;
} SYSTEM_POWER_STATUS, 
*LPSYSTEM_POWER_STATUS;
http://msdn2.microsoft.com/en-us/library/aa372693.aspx

написать длл-обертку, где осуществляется вызов этой функции и возвращается результат в цинк. напрямую вызвать не выйдет.