"Harlan Grove" <(E-Mail Removed)> wrote in message
news:4383036a-1cce-4152-8a36-(E-Mail Removed)...
> Is there a way to detect restarting from hybernate or stand by states
> that I could use to run batch files?
>
> My laptop has a mouse touchpad controller applet that puts an icon
> into the system tray. I'm in the habit of hiding that icon whenever it
> appears. It appears every time my laptop restarts from hybernate or
> stand by states, so I figure there's a background process that puts
> the icon back in the system tray on restart. While one of the things I
> want to do is automate hiding this icon, I'd also like to check and do
> other things on restarts.
Perhaps this might be of use :
http://www.pcreview.co.uk/forums/thread-1495473.php
Pertinent portion of the response:
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/e...gementevent.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