A way is to check the status of the monitor, in a Timer or a Thread
On my OS (Windows 10 21H1), it works with NtPowerInformation, SystemVideoState and DEVICE_POWER_STATE
When the monitor comes back on, I get PowerDeviceD0 (and PowerDeviceUnspecified when I set it off with WM_SYSCOMMAND and SC_MONITORPOWER (not WM_MONITORPOWER which does not exist...)
When SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, WM_MONITORPOWER, 2) is issued, monitors power off, but when interactive action, and monitors come back on, is there a message sent?
When SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, WM_MONITORPOWER, 2) is issued, monitors power off, but when interactive action, and monitors come back on, is there a message sent? There does not seem to be any event fired in the Application, Security or System log. Trying to find a way to hook when the monitors come back online, my application/script can respond to that situation.
If it is a matter of watching the system event queue? For mouse or keyboard input? An example of how to do that via, say powershell, or C# would be wonderful.
Any help greatly appreciated.
-
Castorix31 86,986 Reputation points
2022-06-30T19:16:04.473+00:00
1 additional answer
Sort by: Most helpful
-
Jibun no Kage 21 Reputation points
2022-07-07T01:59:49.667+00:00 Ah, I will give it a shot, thanks.