I'm working on a program that requires the PC to stay online at all times. I want to allow my program to run while the monitor turns off but prevent sleep mode.
For example if I have auto sleep set to enable after 2 minutes of inactivity I'd like this process to begin and the monitor to turn off but the CPU stay active and allow my program to utilize the CPU.
I thought this line would do it but sleep mode still occurs.
SetThreadExecutionState(ES_SYSTEM_REQUIRED);
What am I doing wrong?