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);
        SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT,   timeoutLowPower,   NULL, 0);
        SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT,   timeoutPowerOff,   NULL, 0);
        SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, timeoutScreenSave, NULL, 0);


    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


Log in to reply

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