Jump to content

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


apstanto
 Share

Recommended Posts

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
Link to comment
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.

Link to comment
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! ;)

Link to comment
Share on other sites

  • 9 months later...

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:

Link to comment
Share on other sites

  • 1 year later...

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

  • 11 months later...
  • 3 years later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...