Hibernate and Resume is as simple as WM_POWERBROADCAST and then check the wParam (I believe) for PBT_APMRESUMESUSPEND or PBT_APMSUSPEND![]()
I whipped up an app. It's called PBTintercept. It's just an EXE file and an INI file. It runs silently (find it's process in taskmanager to kill it). It intercepts the shutdown message, and cancels it. Then it runs the specified EXE and waits until that EXE is terminated, or can be set to only wait for a predetermined amount of time. Lastly, the app issues a shutdown command. I've tested it. It works for me. I hope this works on the first try.
VB.Net 2008 souce code is included. I was going to try to detect suspend and hibernate, and go further with this program, but my XP laptop has issues, so testing this is a pain..
From what I read, this app will NOT work in Windows Vista or Windows 7.
Here's what the ini looks like:
[OnShutdown]
Runapp=c:\windows\system32\notepad.exe
RuncmdLine=
MaxWaitSecs=0
Let me know how it goes.
Hibernate and Resume is as simple as WM_POWERBROADCAST and then check the wParam (I believe) for PBT_APMRESUMESUSPEND or PBT_APMSUSPEND![]()
2001 Mustang Convertible Worklog
Indigo Custom Frontend (Flash/Delphi)
Blog
Qube v1.3 Now Available at the mp3Car Store!!!!!!
The simplest IO controller you'll ever use!
PBT_APMRESUMESUSPEND and PBT_APMSUSPEND will detect hibernate/resume and suspend/resume, but I wanted to differentiate between suspend and hibernate. I figured it would be in the wParam or lParam, but I didn't see the information anywhere, and the original poster was only looking to detect shutdown, so I just let it go with that.
The front-end I wrote (DriveLine -- check it out) detects hibernate/resume just fine. But it doesn't need to know the difference between suspend and hibernate.
New Age Garmin - Skin for RR
New Age Slider - RR SKin In Progress
"It's called CODE because I don't want you to know"
Now THAT makes me smile.
As soon as I saw the post that said it was impossible, I knew I'd have to do it.
I knew if I said it was impossible someone would be trying pretty hard to prove me wrong..
"Mamma allways said that nothin' is impossible"
New Age Garmin - Skin for RR
New Age Slider - RR SKin In Progress
"It's called CODE because I don't want you to know"
Nicely done, that's pretty sly
The only reason I knew anything about the ARM commands was because my frontend now also supports hibernate/resume, and similar to yours, ClockWork, doesn't need to know the difference.
2001 Mustang Convertible Worklog
Indigo Custom Frontend (Flash/Delphi)
Blog
Qube v1.3 Now Available at the mp3Car Store!!!!!!
The simplest IO controller you'll ever use!
Thanks for this great app for my current problem! Basically I need to close RR/Winamp first before the PC does a shutdown so that the last VST presets will be saved. Now i'll have to try & create a bat file or find a exe command to close RR.![]()
I think you can write a BAT to do what you need with the TASKLIST and TASKKILL commands.
It's a little tricky, but not impossible.
On second thought, TASKKILL might kill the apps without letting them save their settings. It's worth a try, but might not be the right solution.
Bookmarks