Jump to content

_Timer_GetIdleTime() stopped working . Alternatives?


Recommended Posts

So I've been writing a companion application that monitors a separate bit of software.  When the user stops typing for about a second my companion application will read from that software and perform a supplemental database search.  To reduce the repetitive query count, I've been using _Timer_GetIdleTime() to make sure that I am only performing the search after the user is done typing and nothing on the screen has changed since the last screen read.  This has been working just fine until today.

I don't know if it is related but this morning my Laptop would not wake from sleep and I had to hard reset it.  I then went to Dell.com and applied the below 7 driver/firmware updates.  

- Dell Precision 5570 System BIOS - 1.18.0 - 22.81 MB - Critical
- Killer AX1690/AX1675/AX1650 and Intel AX411/AX211/AX210/AX201/AX200/9560/9462/9260/7265/3165 Bluetooth UWD Driver - A43 - 21.10 MB - Recommended
- Realtek High Definition Audio Driver - A80 - 422.66 MB - Recommended
- Intel Management Engine Components Installer - A08 - 194.63 MB - Critical
- Realtek Memory Card Reader Driver - A02 - 30.41 MB - Critical
- NVIDIA RTX A1000/A2000 Graphics Driver - A08 - 979.09 MB - Critical
- Intel AX411/AX211/AX210/AX201/AX200/9560/9462/9260/7265/3165 Wi-Fi UWD Driver - A50 - 80.58 MB - Recommended

Thereafter, when trying to continue development of my companion application, I find that _Timer_GetIdleTime() and  _WinAPI_GetIdleTime() are constantly being reset by something.

Using the "while loop" I don't ever get idle times above 16ms

While 1
    SplashTextOn("Test of idle timer. Shift-Esc to quit.", "This timer should go up if you do not touch anything." & @CRLF & @CRLF & _Timer_GetIdleTime(),-1,100)
     Sleep(1000)
WEnd

I've read several threads here about similar issues with windows 10 and some game controllers, but I am on windows 11 and have no game controllers.
After restarting I ran the "while loop" script on its own again and I unplugged my external dock/keyboard and mouse and still it persists at 0-16ms maximum idle.  In my short time looking, I couldn't find the appropriate devices to disable for the laptop keyboard and track pad.   So I tried disabling the bluetooth, realtek audio and card reader, and the wifi devices that recieved updates today, but no change. Being a work computer I can't really roll back any of these updates easily as some things are "managed by your organization".

I tired the "while loop" script on a different PC, which worked so I suspect its something from today's updates that I can't readily fix.  So that brings me to looking for a programmatic alternative.

  1. Does anybody know of a tool to help diagnose what driver/service/app might be resetting the idle time?
  2. I can monitor mouse position easy enough, but Is there another way (UDF) to achieve the "get idle time" for keyboard with out going down the road of forbidden topics?

 

Link to comment
Share on other sites

1 hour ago, Humanzee said:

for keyboard with out going down the road of forbidden topics?

Nope. But is not a bad idea.

_Timer_GetIdleTime() is based on any input. A laser mouse may show movement, just because. A worn mouse pad may act the same way. A process may wake up the PC and it's reset. It's a pickle.

On monitor off ?, and check for that ?. Not flawless but may be a good indicator.

Edit: ..thinking about it, nowadays is unlikely that a user don't move the mouse. Going by mouse alone may be the solution.

Edited by argumentum
more

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

1 hour ago, argumentum said:

Going by mouse alone may be the solution.

I think more so that the keyboard idle time is needed.  The scenario is that the users will be filling out a form, not touching the mouse for more than the desired idle trigger, tabbing from field to field.  When they stop typing, I want the companion search to run and produce info they need relevant to the task.  E.g. For near real time error & omission checking, fact finding, historical records etc.  Mousing about, doesn't hurt this but isn't necessary either.

Thinking about it, I already read the whole screen and compare it to the prior values for reading the whole screen.  Perhaps I could make a loop counter that would behave as pseudo idle timer.  e.g. after 100 loops where current screen values = prior screen values,  then run the queries.  The threshold for count of loops could be adjusted until the timing seems right.   In lieu of a working idle timer, I think this could be workable. 

1 hour ago, argumentum said:

On monitor off ?, and check for that ?. Not flawless but may be a good indicator.

Incidentally, I went and ate dinner after my original post, and the PC was not sleeping and monitors were on when I came back nearly 4 hours later.   I think maybe this not idling issue is preventing that.   

As per above, I need like 1-2 second keyboard idle time, not 10 minutes etc.  Just long enough not to bombard the database server with incomplete query parameters.   

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...