c++winapiscreenpower-management

c++ set monitor timeout on Windows


I was wondering if there's a way to enable or disable monitor/screen timeout from a C++ program on a global scale? (I have one catch though, it must be backward compatible with Windows XP SP3.)

I'm talking about this global setting:

Windows 8 screenshot

of this one for XP:

XP screenshot


Solution

  • For those who's interested, here's how to fix this:

    Call CallNtPowerInformation(SystemPowerPolicyAc) API to get or set the display timeout value, and use SYSTEM_POWER_POLICY::VideoTimeout member.