Sign in to follow this  
Followers 0
apstanto

[Solved] Turn screen on after Automatic System-wakeup Event

8 posts in this topic

#1 ·  Posted (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 by apstanto

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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! ;)

Share this post


Link to post
Share on other sites

Finally I was able to solve this! :alien: 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... :ph34r:

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... :huh2:

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

This worked for me too on Windows 7! Thanks.

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
Sign in to follow this  
Followers 0