Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] How to check if computer is not used for some time.
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...
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
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?
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.
koahnig last edited by
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.
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 :-(
"Here is example code":http://www.eggheadcafe.com/microsoft/Win32-Kernel/29542188/sampling-cpu-utilization.aspx on how to use getsystemtimes.
Thank you so much guys!
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.
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!