Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] How to check if computer is not used for some time.
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] How to check if computer is not used for some time.

Scheduled Pinned Locked Moved General and Desktop
9 Posts 3 Posters 3.8k Views 1 Watching
  • 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.
  • Z Offline
    Z Offline
    zakirenish
    wrote on last edited by
    #1

    The process is running all the time on a background and when computer is not used for certain amount of time it needs to do some.
    First i thought to check mouse position if changed from the last time. But it records the position only if the widget is shown. I don`t want to show widget.
    Now i think maybe there is a way to check screen saver state...
    Any ideas?
    Thank you!

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      Afaik this cannot be done by Qt directly. You will need to go in the OS API.

      On windows you can use "GetSystemTimes":http://msdn.microsoft.com/en-us/library/ms724400

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        zakirenish
        wrote on last edited by
        #3

        Hey thanks. But i am new to programming. Can you please explain how to use it.
        I include <winbase.h> and <windows.h> but then how you get the state out of it?
        Thank you!

        1 Reply Last reply
        0
        • EddyE Offline
          EddyE Offline
          Eddy
          wrote on last edited by
          #4

          It has been some time since I used it with VB.

          What have you tried so far?

          I'll have a look if I can dig up something.

          You'll have to use WINAPI. maybe you'll get a faster solutiuon on a windows c++ forum.

          Qt Certified Specialist
          www.edalsolutions.be

          1 Reply Last reply
          0
          • K Offline
            K Offline
            koahnig
            wrote on last edited by
            #5

            You could possibly use "QThread":http://doc.qt.nokia.com/4.7/qthread.html there is at least a possibility to set the priority appropriately.
            "Priority":http://doc.qt.nokia.com/4.7/qthread.html#Priority-enum
            I have never changed the priorities so far. Therefore, I do not know if it helps at all.
            Furthermore, this may not be some beginner's stuff :-(

            Vote the answer(s) that helped you to solve your issue(s)

            1 Reply Last reply
            0
            • EddyE Offline
              EddyE Offline
              Eddy
              wrote on last edited by
              #6

              "Here is example code":http://www.eggheadcafe.com/microsoft/Win32-Kernel/29542188/sampling-cpu-utilization.aspx on how to use getsystemtimes.

              Qt Certified Specialist
              www.edalsolutions.be

              1 Reply Last reply
              0
              • Z Offline
                Z Offline
                zakirenish
                wrote on last edited by
                #7

                Thank you so much guys!

                1 Reply Last reply
                0
                • EddyE Offline
                  EddyE Offline
                  Eddy
                  wrote on last edited by
                  #8

                  Does this mean your topic is solved? In that case could you add [Solved] in front of your title by editing your first post.

                  If you can share it with us, we would appreciate to know how you solved it.

                  Qt Certified Specialist
                  www.edalsolutions.be

                  1 Reply Last reply
                  0
                  • Z Offline
                    Z Offline
                    zakirenish
                    wrote on last edited by
                    #9

                    Yes i did this on Win api level by calling the Function: SystemParametersInfoA() with parameter SPI_GETSCREENSAVERRUNNING to check if the screen Saver went on!

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved