Page 1 of 5 12345 LastLast
Results 1 to 10 of 44

Thread: Laptop Half Arsed Shutdown Control System...

  1. #1
    Low Bitrate
    Join Date
    Jun 2006
    Posts
    98

    ShutControl

    ShutControl - Shutdown Control Software for Laptops

    THIS THREAD HAS MOVED HERE

    PLEASE CHANGE YOUR SUBSCRIPTION/BOOKMARK LOCATION AND PLEASE DO NOT POST IN THIS THREAD ANY LONGER

  2. #2
    Variable Bitrate Zogg's Avatar
    Join Date
    Apr 2005
    Location
    Plano, TX
    Posts
    311
    This is a very interesting system. Thanks for all your detailed information and for sharing the files.

    The embedded cpu board I was using won't suspend or hibernate, so I am now going to use an old Dell laptop w/ docking station that became available. My plan was to use Windows to Suspend after a few minutes when it switched to battery power, and to Hibernate a few minutes after that. Then use the ignition power line to control a relay that would toggle the power button on the dock to turn it back on.

    I was wondering why you weren't using Suspend any during your process, was it just to keep things simple and consistent or did you try using Suspend also and it didn't work properly? I haven't tested the Suspend->Hibernation cycle yet with RR running, so maybe that isn't going to work if music is playing.

    Thanks,
    Z
    Zotac N630I-D-E M/B w/ Nvidia 7100, E5300 cpu, Xenarc 700IDT, M2-ATX, XP, RR & DFX 5.1.

  3. #3
    Low Bitrate
    Join Date
    Jun 2006
    Posts
    98
    I didn't bother with suspend because the cars battery life is very important to me (its bad enough as it is). Hibernate is the ideal option. I was getting frustrated watching the host of batch files run and go crazy, so I'm recoding the lot in Java - a proper coding language.

    I will post back on here in about 1 hour when I'm done. I've noticed a few more niggles, and I figure I may as well restart the machine immediately after going onto battery (for a clean run) then after restarting, make the machine hibernate, then after resuming from hibernate, load all the apps. I might even make a GUI if I can be bothered.

    '98 Peugeot 306
    Project Status: I sold it ages ago!

    ShutControl

    The ultimate shutdown control software for laptops.

  4. #4
    Newbie
    Join Date
    Apr 2006
    Posts
    12
    Thanks for the software ideas - I may be able to use this to shutdown my GPS so that I don't have startup problems.

    I'm doing something very similar, with a couple more bells and whistles:

    1) A delay circuit that waits for about 12 minutes after the ignition goes off before killing power to the PC. This is so I can stop and get gas, or leave the machine on when I pull into the garage and connect to my network

    2) A separate relay to power my usb audio, LCD screen, etc. using the external keyboard connector on my laptop, so that everything goes up/down together (power only goes off when hibernation is complete).

    This works so well that I'm surprised more people don't use laptops.....

  5. #5
    Constant Bitrate
    Join Date
    Jul 2006
    Location
    British Columbia, Canada
    Posts
    113
    Hey bud,
    Great program, well it doesnt work for me but its exactly what I need.

    I followed all the instructions and when I remove the power of my laptop it opens a java window and says Are You Sure? and I get a button "Abort"

    Can you help me fix this.

    Thanks

  6. #6
    One Sharp Cheddar ThunderStick's Avatar
    Join Date
    Aug 2006
    Location
    West Allis, WI
    Posts
    1,657
    I used to use this same concept a couple of years ago when I first got started. It works great for people using inverters or others using alternative power supplies such as laptop adapters.
    I still reccommend a shutdown controller at the least though. This will work, but if your computer hangs or you use a different method of shutting down other than shutdown, you are prone to a dead battery.
    Shutdown controllers cost about $35.00 and are welll worth it. I suggest the
    THIS ONE
    I have used it before and actually used it for about a year to switch on and off my inverter which power my ATX computer (350watt PSU), USB hub and a few other small items.

    EDIT:
    Sorry didnt read the whole post, I thought this was another schematic for shuting down your computer and cutting power using relays.
    My bad

  7. #7
    Low Bitrate dontpntpool's Avatar
    Join Date
    Aug 2006
    Location
    IA
    Posts
    96
    Is there such a thing as a shutdown controller for a laptop? It would be nice if I could get rid of the brickpack.

  8. #8
    Low Bitrate dontpntpool's Avatar
    Join Date
    Aug 2006
    Location
    IA
    Posts
    96
    I wrote a laptop menu program once that had battery information in it in vb.

    Wouldnt it just be posible to have a watchdog program watching for battery and then run the system command shutdown instead of all this? btw did I say I hate java?

    I am sure this info is around here already.

    Code:
    'battery info
    Private Declare Function GetSystemPowerStatus Lib "kernel32" (lpSystemPowerStatus As SYSTEM_POWER_STATUS) As Long
    Private Declare Function SetSystemPowerState Lib "kernel32" (ByVal fSuspend As Long, ByVal fForce As Long) As Long
    
    Private Type SYSTEM_POWER_STATUS
        ACLineStatus As Byte 'Checks to see if your connected to the walloutlet or not
        BatteryFlag As Byte 'Battery status
        BatteryLifePercent As Byte 'precentage left
        Reserved1 As Byte 'Dont use
        BatteryLifeTime As Long 'Total time left of your battery
        BatteryFullLifeTime As Long 'Total UPtime of your battery
    End Type
    
        If SystemPower.ACLineStatus = 0 Then
            Label4.Caption = "BATTERY"
        ElseIf SystemPower.ACLineStatus = 1 Then
            Label4.Caption = "AC POWER"
        End If
    
        If SystemPower.BatteryFlag = 1 Then
            Label4.Caption = "HIGH" + vbNewLine + Label4.Caption
        ElseIf SystemPower.BatteryFlag = 2 Then
            Label4.Caption = "LOW" + vbNewLine + Label4.Caption
        ElseIf SystemPower.BatteryFlag = 4 Then
            Label4.Caption = "CRITICAL" + vbNewLine + Label4.Caption
        ElseIf SystemPower.BatteryFlag = 128 Then
            Label4.Caption = "NO BATTERY" + vbNewLine + Label4.Caption
        End If
    You get the idea I just cut some of my code from my vb project... it should be really easy to call the dos command

    Code:
    Usage: shutdown [/i | /l | /s | /r | /a | /p | /h | /e] [/f]
        [/m \\computer][/t xxx][/d [p:]xx:yy [/c "comment"]]
    
        No args    Display help. This is the same as typing /?
        /?         Display help. This is the same as not typing any options
        /i         Display the graphical user interface (GUI).
                   This must be the first option
        /l         Log off. This cannot be used with /m or /d option
        /s         Shutdown the computer
        /r         Shutdown and restart the computer
        /a         Abort a system shutdown.
                   This can only be used during the time-out period
        /p         Turn off the local computer with no time-out or warning.
                   This can only be used with /d option
        /h         Hibernate the local computer.
                   This can only be used with the /f option
        /e         Document the reason for an unexpected shutdown of a computer
        /m \\computer Specify the target computer
        /t xxx     Set time-out period before shutdown to xxx seconds.
                   The valid range is 0-600, with a default of 30
        /c "comment" Comment on the reason for the restart or shutdown.
                   Maximum of 127 characters allowed
        /f         Force running applications to close without forewarning users
        /d [p:]xx:yy  Provide the reason for the restart or shutdown
                   p indicates that the restart or shutdown is planned
                   xx is the major reason number (positive integer less than 256)
                   yy is the minor reason number (positive integer less than 65536)

  9. #9
    Low Bitrate
    Join Date
    Jun 2006
    Posts
    98
    Goddamn you man, I just spent the last 4 hours learning how to use VB (from scratch) and make an application that did everything. At the moment, its kinda buggy, its terminating itself for no reason. I will post all the source on here, and see if someone can sort it.

    My code is really messy, so I do apologise, but I have never used this language before, and it is still being debugged.

    EDIT: ATTACHMENT LINKS REMOVED - USE DOWNLOAD LINKS AT TOP

    '98 Peugeot 306
    Project Status: I sold it ages ago!

    ShutControl

    The ultimate shutdown control software for laptops.

  10. #10
    Low Bitrate dontpntpool's Avatar
    Join Date
    Aug 2006
    Location
    IA
    Posts
    96
    I will look at it tomorrow when I get to work...I dont have vs.net on my laptop.

    My vb laptop project was actually a shell replacement because the people using it were to dumb to use xp, and its been in use by about 80 people for the past 7 years, so vb works pretty good for this type of thing.

    I looked at the form code in notepad. Why are you running bat files? I would just run the shutdown cmd from vb so you can check for response codes. If you want the different commands to be customizable make an ini or cfg file that has the differnt options for the things you want to do and then the command they are supposed to run.

    http://www.codeproject.com/vb/net/INIFileClass.asp
    Example.ini
    Code:
    [shutdown]
    command=shutdown.exe /s
    silent=true
    force=true
    timeout=30
    [reboot]
    command=shutdown.exe /r
    silent=false
    force=false
    timeout=60
    [hibernate]
    command=shutdown.exe /h
    silent=true
    force=true
    timeout=15
    [forced]
    command=shutdown.exe /p /d
    silent=true
    force=true
    timeout=1
    [abort]
    command=shutdown /a
    Then you could set it up to check for response codes...or even run dos batch scripts if you want.

    also I think you could skip all this and use direct calls like:
    http://www.codeproject.com/system/StayON.asp
    Code:
    Application.SetSuspendState(PowerState.Hibernate, true, true);
    or
    Code:
    using System.Runtime.InteropServices;
    [DllImport("user32.dll")]
    public static extern int ExitWindowsEx(int uFlags, int dwReason);
    also maybe some of the hibernate issues need this fix
    http://www.microsoft.com/downloads/d...displaylang=en

Page 1 of 5 12345 LastLast

Similar Threads

  1. Replies: 85
    Last Post: 07-09-2007, 04:44 AM
  2. Replies: 1
    Last Post: 02-03-2004, 07:07 AM
  3. Auto shutdown when laptop goes to battery
    By W6-Ryan in forum Software & Software Development
    Replies: 6
    Last Post: 09-02-2003, 02:03 PM
  4. Wanna power this laptop since I fried my system today.
    By MikeHunt79 in forum Power Supplies
    Replies: 6
    Last Post: 07-07-2003, 11:24 AM
  5. control laptop from cd changer?
    By aharrover in forum General Hardware Discussion
    Replies: 1
    Last Post: 12-11-2001, 01: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
  •