Jump to content
rory

Building your own laptop computer

Recommended Posts


on the subject of laptops and without starting a new thread, i have my first real laptop, not one I just fix for other people nor the old DOS one I used to have

 

Anyway, no matter what you do, if you want it so when you are portable and you close the lid it goes into standby, I want that, so I save battery, but no matter what powercfg commands or power scheme settings when it is on AC and you close the lid, it also goes into standby. See I also use it at home with a separate LCD, keyboard and mouse. That would be fine if my USB mouse or Keyboard would work once its in Standby, but not on the laptop it doesnt. Basically I want it so it Wakes on USB but my laptop does not do that, also I want it to only go into Standby on DC, or if the Lid is closed not to go into Standby if it is on AC.

 

SO after much research for literally hours and hours and thousands of websites including MS sites, I wrote my own little app late last night that does this: When the PC sends a Standby (sleep) message, my program checks to see if it is on battery or AC, if it is on AC it denies the request and stays on. Voila!! Problem fixed

 

I want to add some more to the app such as minimize it to the system tray (it is hidden when it runs right now) and also have a tray menu that has manual sleep button and maybe some other basic options, but for now, if anyone wants the app as it is, let me know. It uses subclassing, so no timer, doesnt seem to cause any issues so far and neither does it take up any CPU and only uses very small amount of memory.

Share this post


Link to post
Share on other sites

Rory does your app work with any OS? or is it just for XP? I would be interested in seeing this if you can send it to me. Thanks

Share this post


Link to post
Share on other sites

Hi, its on XP right now, not sure if it will work on Vista but I imagine i will if the power APIs are the same.

Share this post


Link to post
Share on other sites

I just realized I don't really need it when it is just on AC, infact need it to also be when on DC otherwise when the power is off and you close the lid it will still go into standby. SO, i need to check for the VGA output to see if another monitor is attached, instead of just for AC.

 

Will let you know when its done.

Share this post


Link to post
Share on other sites

ok here is something to test, I say test as although it works for me, it may still produce errors or not work for others. Tested on my HP 6510b with put PC in standby set on lid close. No installer, just tested on XP SP2 (not tested on others yet but go right ahead). Requires VB Runtimes installed (XP has those).

 

It ignores standby when you click shutdown, and also automatic standby set in the Power Scheme as x amount of minutes, as these do not trigger any display changes.

 

Hot Keys:

 

CTL-ALT-F7 = always suspend on dc (with or without external monitor)

CTL-ALT-F8 = check for monitor on both ac and dc (default)

CTL-ALT-F9 = add to start up (uses current exe file and path)

CTL-ALT-F10 = remove from start up (removes any items with its title)

CTL-ALT-S = manual suspend - query suspend method, not force

CTL-ALT-H = hide icon from system tray

CTL-ALT-V = show icon in system tray

CTL-ALT-X = exit program

 

Commands: (not case sensitive)

 

/FORCEDC = always suspend on dc

/HIDDEN = hides icon from system tray

/NOHOTKEYS = disables hotkeys feature

/NOLOG = does not use a log file

 

By Default it will create daily log files under the root drive and \SleepFix.

You can turn that off with the optional commands.

Log is useful though incase there are any errors or something does not work properly.

 

http://www.bahamassecurity.com/uploads/SleepFix.exe

 

Good luck!

Rory

Share this post


Link to post
Share on other sites

Example log file will look like this:

 

2/3/2008 7:12:20 PM - Program Started

2/3/2008 7:12:25 PM - Tray Icon Removed

2/3/2008 7:12:27 PM - Tray Icon Installed

2/3/2008 7:16:14 PM - Suspend Request Received

2/3/2008 7:16:14 PM - Suspend Request Paused

2/3/2008 7:16:19 PM - Suspend System Now

2/3/2008 7:16:38 PM - Resumed from Suspend

2/3/2008 7:16:38 PM - Resumed Automatically

2/3/2008 7:16:48 PM - Suspend Request Received

2/3/2008 7:16:48 PM - Suspend Request Paused

2/3/2008 7:16:49 PM - Window Changing Z Order Position

2/3/2008 7:16:53 PM - System will Stay On

2/3/2008 7:18:30 PM - Exit Program Manually

2/3/2008 7:18:30 PM - Program Ended

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×