I'm turning off the monitor using SendMessage(HWND_BROUADCART, WM_SYSCOMMAND, SC_MONITORRPOWER, 2)
.
That works, but the monitor turns back on when someone touches the keyboard or mouse. I tried to get rid of this using the DevicePowerSetDeviceState function with DEVICEPOWER_CLEAR_WAKEENABLED for the keyboard and mouse: it returns no error, but has no effect either.
How can I prevent the monitor from powering back on in Vista and Windows7?