I would like to use RegisterPowerSettingNotification in VB6.
It expects a GUID as a parameter:
HPOWERNOTIFY RegisterPowerSettingNotification(
HANDLE hRecipient,
LPCGUID PowerSettingGuid,
DWORD Flags
);
I don't find any examples on how to do that in VB6. Specifically, I don't understand how to define this GUID. I guess it's not just a string.
This is what I could come up with so far:
Private hPowerSrc&
Private hBattCapacity&
Private hMonitorOn&
Private hPowerScheme&
Private Const DEVICE_NOTIFY_WINDOW_HANDLE As Long = 0
Private Sub pInitPower()
hPowerSrc = RegisterPowerSettingNotification(Me.hWnd, GUID_ACDC_POWER_SOURCE, DEVICE_NOTIFY_WINDOW_HANDLE)
hBattCapacity = RegisterPowerSettingNotification(Me.hWnd, GUID_BATTERY_PERCENTAGE_REMAINING, DEVICE_NOTIFY_WINDOW_HANDLE)
hMonitorOn = RegisterPowerSettingNotification(Me.hWnd, GUID_MONITOR_POWER_ON, DEVICE_NOTIFY_WINDOW_HANDLE)
hPowerScheme = RegisterPowerSettingNotification(Me.hWnd, GUID_POWERSCHEME_PERSONALITY, DEVICE_NOTIFY_WINDOW_HANDLE)
End Sub
How would I complete this sample including the API declaration and GUIDs and calling it?
Thank you!