Prevent screensaver and screen dimming



  • Greetings,

    I'm on a windows 7 laptop.

    I'm trying to prevent the screensaver and the screen dimming from my Qt app.

    I'm using the following code:
    @#ifdef Q_OS_WIN
    if (enable == false)
    {
    SystemParametersInfo(SPI_GETLOWPOWERTIMEOUT, 0, &(timeoutLowPower), 0);
    SystemParametersInfo(SPI_GETPOWEROFFTIMEOUT, 0, &(timeoutPowerOff), 0);
    SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, &(timeoutScreenSave), 0);

        SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT,   0, NULL, 0);
        SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT,   0, NULL, 0);
        SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, 0, NULL, 0);
    }
    else
    {
        SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT,   timeoutLowPower,   NULL, 0);
        SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT,   timeoutPowerOff,   NULL, 0);
        SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, timeoutScreenSave, NULL, 0);
    }
    

    #endif@

    This disables the screensaver but not the screen dimming.

    Has anyone got a clue on how to disable Windows 7 auto brightness ?

    Update: posted on MSVC http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/72adb664-13f6-4a5b-8666-b99d3e744517

    Thanks.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.