I need to track the monitor getting to sleep and awaking from sleep (energy saving):
Private Const SC_MONITORPOWER = &HF170&
Private Const MONITOR_OFF = 2&
Private Const MONITOR_ON = -1&
Private Const MONITOR_STANDBY = 1&
Here is my subclassing code:
If (uMsg = WM_SYSCOMMAND) Then
If (wParam = SC_MONITORPOWER) Then
If (lParam = MONITOR_OFF) Then
'I do receive this event!
Debug.Print("Monitor is turned off")
ElseIf (lParam = MONITOR_ON) Then
Stop 'This is never called
Else
Stop 'This is never called
End If
End If
End If
If the monitor goes to sleep, a WM_SYSCOMMAND message is broadcast.
However, I don't get a WM_SYSCOMMAND when the monitor is turned on again (for example by moving the mouse).
How do I track then monitor gets re-activated / turned on again?
What am I doing wrong?
Thank you!