swi Posted May 26, 2009 Posted May 26, 2009 Win7 uses a different API than XP and Vista so I am having trouble creating a script to automate a resume from hibernate or standby. I have seen this thread: http://www.autoitscript.com/forum/index.php?showtopic=21575 and have been able to use this code in order to resume on XP but cannot get it to work with Win7. Any help is appreciated.
evilertoaster Posted May 26, 2009 Posted May 26, 2009 The windows API are mostly backwards compatible so I'm guessing the code should work...However I believe there have been some problems with the windows 7 sleep/hibernate feature... for example-http://gizmodo.com/5133399/win-7-tip-sleep...te-your-machinehttp://www.windows7taskforce.com/view/979http://mydellmini.com/forum/vista/794-wind...oesnt-work.htmlhttp://social.technet.microsoft.com/Forums...19-85a9db02b0b6Which may have some contribution to your problem...What exactly does the code do when you run it? any errors or does literally nothing happen?
swi Posted May 26, 2009 Author Posted May 26, 2009 (edited) It hibernates but will not resume. However there are no problems if I try to hibernate/resume manually. This is why I think it has something to do with the API. I noticed Win7 uses new API: SetWaitableTimerEx (http://msdn.microsoft.com/en-us/library/dd405521(VS.85).aspx) and CreateWaitableTimerEx. The previous SetWaitableTimer has 'BOOL fResume' parameter that can be set to TRUE to resume the machine. However, SetWaitableTimerEx removes this fResume parameter and replace it with WakeContext. Iam not really sure how to use this new parameter to resume the system. Any idea? Edited May 26, 2009 by swi
swi Posted June 12, 2009 Author Posted June 12, 2009 It turns out that the script I linked to in the fist post using windows API does work. As eviltoaster said the API is backwards compatible. But there is a new Advanced Power Option in Win7 under the 'Sleep' category called 'Allow Wake Timers'. By default it is set to 'disable', which is what caused the script to fail. This option does not exist on Vista or XP. Now I just have to find some way to change this option through automation. My intention is to have this autmation run on various computers with unknown configurations. Powercfg is not yet able to modify this setting as far as I'm aware, so I was going to export a working powerplan and then import it onto computers when the script is run.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now