ECL said:
During standby or hibernate operation, is there any way to detect if it is an automatic (system initiative ->timeout which is configured in power management was expired) or manual operation (button press by user for example) and if it is hibernate or standby operation?
Hi
You can use the WMI Win32_PowerManagementEvent to detect a standby event (and maybe other things as well). Try the script below and see what you get as result.
Win32_PowerManagementEvent WMI class
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_powermanagementevent.asp
A vbscript example (will loop forever until terminated):
Set colMonitoredEvents = GetObject("winmgmts:")._
ExecNotificationQuery("Select * from Win32_PowerManagementEvent")
Do
Set strLatestEvent = colMonitoredEvents.NextEvent
Select Case strLatestEvent.EventType
Case 4
MsgBox "Entering suspend."
Select Case strLatestEvent.EventType
Case 7
MsgBox "Resuming from suspend."
Case 11
MsgBox "OEM Event happened, OEMEventCode = " _
& strLatestEvent.OEMEventCode
Case 18
MsgBox "Resume Automatic happened"
End Select
Loop