View Poll Results: Is this working for you?

Voters
2. You may not vote on this poll
  • Yes, I have Windows XP home

    1 50.00%
  • No, I have Windows XP home

    0 0%
  • Yes, I have Windows XP Pro

    1 50.00%
  • No, Windows XP Pro

    0 0%
  • Yes, I have Windows Vista

    0 0%
  • No, I have Windows Vista

    0 0%
Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 44

Thread: Run command when power button pushed

  1. #21
    Mod - Driveline forum
    Auto Apps:loading...
    ClockWorK's Avatar
    Join Date
    Oct 2003
    Location
    Michigan
    Posts
    718

    Smile Try this

    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.
    Attached Files Attached Files

  2. #22
    Vendor - Qube colin's Avatar
    Join Date
    Dec 2006
    Posts
    796
    Hibernate and Resume is as simple as WM_POWERBROADCAST and then check the wParam (I believe) for PBT_APMRESUMESUSPEND or PBT_APMSUSPEND

  3. #23
    Mod - Driveline forum
    Auto Apps:loading...
    ClockWorK's Avatar
    Join Date
    Oct 2003
    Location
    Michigan
    Posts
    718
    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.

  4. #24
    One Sharp Cheddar ThunderStick's Avatar
    Join Date
    Aug 2006
    Location
    West Allis, WI
    Posts
    1,657

    Thumbs up

    Quote Originally Posted by ClockWorK View Post
    I whipped up an app.
    ...
    Let me know how it goes.
    WORKS AWSOME
    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"

  5. #25
    Mod - Driveline forum
    Auto Apps:loading...
    ClockWorK's Avatar
    Join Date
    Oct 2003
    Location
    Michigan
    Posts
    718

    Cool

    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.

  6. #26
    One Sharp Cheddar ThunderStick's Avatar
    Join Date
    Aug 2006
    Location
    West Allis, WI
    Posts
    1,657
    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"

  7. #27
    Vendor - Qube colin's Avatar
    Join Date
    Dec 2006
    Posts
    796
    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.

  8. #28
    Low Bitrate Cycfari's Avatar
    Join Date
    Nov 2006
    Location
    N1 22.921 E103 54.207
    Posts
    87
    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.

  9. #29
    Mod - Driveline forum
    Auto Apps:loading...
    ClockWorK's Avatar
    Join Date
    Oct 2003
    Location
    Michigan
    Posts
    718
    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.

  10. #30
    Mod - Driveline forum
    Auto Apps:loading...
    ClockWorK's Avatar
    Join Date
    Oct 2003
    Location
    Michigan
    Posts
    718
    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.

Page 3 of 5 FirstFirst 12345 LastLast

Similar Threads

  1. 2008 Yaris 4 Door Sedan PC Install
    By rizaydog in forum Show off your project
    Replies: 55
    Last Post: 05-21-2009, 07:03 AM
  2. Utility to change behavior of ATX power button (e.g.: launch an app)
    By justintime in forum Software & Software Development
    Replies: 83
    Last Post: 05-08-2009, 04:45 PM
  3. 2007 Ford Fusion Carputer (version 2.0)
    By FusionFanatic in forum Show off your project
    Replies: 43
    Last Post: 04-20-2009, 04:56 PM
  4. DC-DC Car Power for Mac Mini
    By MikeH in forum MacCar
    Replies: 53
    Last Post: 02-19-2005, 12:13 PM
  5. I want to add a power button on my dash. Which can i use?
    By Sonicxtacy02 in forum General Hardware Discussion
    Replies: 2
    Last Post: 10-25-2004, 03:17 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •