apstanto Posted September 8, 2010 Share Posted September 8, 2010 (edited) I've based my script off of the code found here. The powersave/resume works except I'm having a little trouble with Windows XP (more info). But what I want to solve right now is how to turn on my screen when the computer resumes. I see this in Windows XP. I realize when you set an Automatic System-wakeup Event, it does not turn the display on. So I tried this Monitor On/Off help and it fairly well on it's own with the hot-keys. But the monitor on functionality doesn't seem to work after a standby or hibernate. Any ideas of how to get the monitor back on?Edit: Marked as [solved] Edited September 8, 2010 by apstanto Link to comment Share on other sites More sharing options...
somdcomputerguy Posted September 8, 2010 Share Posted September 8, 2010 So I tried this Monitor On/Off help and it fairly well on it's own with the hot-keys. But the monitor on functionality doesn't seem to work after a standby or hibernate.Can't you just call the _Monitor_ON function in that script? - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
apstanto Posted September 8, 2010 Author Share Posted September 8, 2010 Can't you just call the _Monitor_ON function in that script?Yep, I did. It doesn't seem to have any effect after a resume. I think the System Wake-up Event does something different, not allowing the _Monitor_ON function to work. Link to comment Share on other sites More sharing options...
apstanto Posted September 8, 2010 Author Share Posted September 8, 2010 After a resume, if I wiggle the mouse, the screen will come on. So I tried wiggling the mouse with the MouseMove function, but that didn't work either. Link to comment Share on other sites More sharing options...
apstanto Posted September 8, 2010 Author Share Posted September 8, 2010 Finally I was able to solve this! I'm really excited! So here's what I found: according to Microsoft's System Wake-up Events, "When the system wakes automatically, the display is not automatically turned on." I was able to figure out how to get the screen on after a resume. The function below will do it. #cs ********************************************************************************************************* Function Name: _Monitor_ON Author: apstanto Description: Turns the monitor on after a System Wake-up Event and broadcast of PBT_APMRESUMEAUTOMATIC Input: None Return: Success: @error = 0. Failure: set @error @error: 1 unable to use the DLL file, 2 unknown "return type", 3 "function" not found in the DLL file, 4 bad number of parameters. #ce ********************************************************************************************************* Func _Monitor_ON() $ES_DISPLAY_REQUIRED = 2 DllCall("Kernel32.dll", "long", "SetThreadExecutionState", "long", $ES_DISPLAY_REQUIRED) EndFuncI hope this works for you too! PHAK and Earthshine 2 Link to comment Share on other sites More sharing options...
doorito Posted June 17, 2011 Share Posted June 17, 2011 Finally I was able to solve this! I'm really excited! So here's what I found: according to Microsoft's System Wake-up Events, "When the system wakes automatically, the display is not automatically turned on." I was able to figure out how to get the screen on after a resume. The function below will do it. #cs ********************************************************************************************************* Function Name: _Monitor_ON Author: apstanto Description: Turns the monitor on after a System Wake-up Event and broadcast of PBT_APMRESUMEAUTOMATIC Input: None Return: Success: @error = 0. Failure: set @error @error: 1 unable to use the DLL file, 2 unknown "return type", 3 "function" not found in the DLL file, 4 bad number of parameters. #ce ********************************************************************************************************* Func _Monitor_ON() $ES_DISPLAY_REQUIRED = 2 DllCall("Kernel32.dll", "long", "SetThreadExecutionState", "long", $ES_DISPLAY_REQUIRED) EndFunc I hope this works for you too! This works for me...Thank you... Now I can't figure out how to get the screensaver to go away, I have tried mousemove but it's probably moved in the background. Is there no way to simulate a hardware mouse or keyboard move? I have some unattended distribution at night, the problem is it requires a reboot after the distribution. If the Monitor is off and the screensaver is active(duh) the reboot will be stalled. When a user moves the mouse or press a key on the keyboard the shutdown is triggered. With your help, I'm so close... Link to comment Share on other sites More sharing options...
gcue Posted March 27, 2013 Share Posted March 27, 2013 Finally I was able to solve this! I'm really excited! So here's what I found: according to Microsoft's System Wake-up Events, "When the system wakes automatically, the display is not automatically turned on." I was able to figure out how to get the screen on after a resume. The function below will do it. #cs ********************************************************************************************************* Function Name: _Monitor_ON Author: apstanto Description: Turns the monitor on after a System Wake-up Event and broadcast of PBT_APMRESUMEAUTOMATIC Input: None Return: Success: @error = 0. Failure: set @error @error: 1 unable to use the DLL file, 2 unknown "return type", 3 "function" not found in the DLL file, 4 bad number of parameters. #ce ********************************************************************************************************* Func _Monitor_ON() $ES_DISPLAY_REQUIRED = 2 DllCall("Kernel32.dll", "long", "SetThreadExecutionState", "long", $ES_DISPLAY_REQUIRED) EndFunc I hope this works for you too! it worked for me too! laptop, desktop (xp and win 7) great job! thanks Link to comment Share on other sites More sharing options...
jctenne Posted March 4, 2014 Share Posted March 4, 2014 This worked for me too on Windows 7! Thanks. Link to comment Share on other sites More sharing options...
adcrazynoga Posted February 1, 2018 Share Posted February 1, 2018 It work fine, but just for AC mode. I dont know why when i plug out. It doesn't work for battery mode. Anyone can help me ? Link to comment Share on other sites More sharing options...
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