Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running Batch or Script on Resume From Standby 1

Status
Not open for further replies.

nealvenables

Programmer
Jun 27, 2002
141
0
0
GB
Hi,

Short version of this question first:-

Is it possible to configure WinXP Pro so that it automatically executes a batch file (or other type of script) whenever it resumes from standby mode?

Longer version:-

I use a PCI latency utility to override the default PCI latencies on my PC (prevents sound-card stuttering and pagefile warnings on a PCI SATA card). Currently the utility auto-executes at boot and works fine. However, when the PC resumes from standby the latency overrides are lost and the PC resumes to a "vanilla" state as far as latencies go.

What I'm hoping is that I can configure XP to automatically execute

"C:\Program Files\PCI Latency Tool 2\LtcyCfg.exe" /a

whenever it resumes from standby.

btw - I've got as far as setting up the command as a shortcut on my QuickLaunch bar, which means that currently all it takes is a single click on my part to reset my latencies after standby, but I'd really like to automate this process.

Any suggestions appreciated...
 
i wrote something using WMI to act on change of power state, little problem we were having with hibernation and DFS. i used an event notification query, you can do it async of blocked method call. you would hope there was something built into XP though...would be glad to hear if there is
 
'cant find my code but this was off google

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
 
Thanks! I'll have a play with this code when I've got an afternoon free :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top