This was originally posted on APC forums on 3/16/2013
Hi,
I have both a BK350EI and a BE700G-GK.
Windows 7 x64.
I'm trying to make a VC2008 c++ program detect when the UPS is on battery power.
Is there a way to detect "power off line" status via the existing windows APIs for this purpose. If not - Why not?
Is the only benefit of this device some low sounding beeps that goes of 10 minutes before the power is cut?
i.e a delay of the power cut, but if no one hears the alarm no one hears the beeps there are no benefits at all?
There must be a way to write a program that can detect the power problem - I want to do that using WIN32 and c++...
Have tried two different approaches:
1. fails to detect anything when the UPS plug is removed from the wall.
SYSTEM_POWER_STATUS stPS;
GetSystemPowerStatus(&stPS);
- same info returned both when on battery and when on line power.
2. fails to detect anything when the UPS plug is removed from the wall.
WM_POWERBROADCAST via
hPowerSourceNotify = RegisterPowerSettingNotification( hWnd, &GUID_ACDC_POWER_SOURCE, DEVICE_NOTIFY_WINDOW_HANDLE );
hBatteryPowerNotify = RegisterPowerSettingNotification( hWnd, &GUID_BATTERY_PERCENTAGE_REMAINING, DEVICE_NOTIFY_WINDOW_HANDLE );
- no events are sent when on battery.
The USB cable to the computer should add expected benefits, not confined to the PowerChute software.
How do you access useful info from the UPS device using VC2008 c++ in windows?
Regards
/Ronnie