Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can VB6 detect when windows turns off the monitor in power saving mode 2

Status
Not open for further replies.

SkennyR

Programmer
Mar 7, 2004
157
US
I would like to be able to detect when windows goes into power saving mode, for example, turns the monitor off.
I would like to turn on (or off) a printer port output to dim a marquee lamp above the monitor when the monitor shuts down.
I already know how to read and write to the printer port, but I cant find any threads in here to tell me how to get VB6 to know when the computer has powered down automatically.
Thanks in advance.
 
Last method didnt work.
I added Now to the debug.print statement and got this output:

Started
4217646
5/8/2009 9:39:51 AMscreen saver on
5/8/2009 9:39:51 AMscreen saver off
Ended

left PC in screen saver mode for 5 minutes.
So the "screen saver off" is firing at the same time the "screen saver on" is.
 
------------------------------------------------------------
If wMsg = WM_SYSCOMMAND And wParam = SC_SCREENSAVE Then
Debug.Print "screen saver on"
x = 1
End If

[red]<ahem> ... at this point if previous If has fired then x=1, which means next If will ALSO fire[/red]

If wMsg = WM_SYSCOMMAND And x = 1 Then
Debug.Print "screen saver off"
x = 0
End If
---------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top