Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Prevent screensaver and screen dimming

    General and Desktop
    1
    1
    2795
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      bunjee last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post