I've got this tiny little program that's intended to do nothing but power off my monitor.
Code:
#include <Windows.h>
int main() {
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);
return 0;
}
It works, as in it compiles and when I double-click on the exe file, my monitor turns off but the computer stays on. The problem is, when I move my mouse or press a button to turn the monitor back on, there's a black console window in the middle of the screen that I have to manually close. What I would expect to happen is that the program runs, shutting off the monitor, and then exits. That doesn't seem to be happening.
Any advice?