Home » Questions » Computers [ Ask a new question ]

How can you tell when a user last pressed a key (or moved the mouse)?

How can you tell when a user last pressed a key (or moved the mouse)?

"In a Win32 environment, you can use the GetLastInputInfo API call in Microsoft documentation. Basically, this method returns the last tick that corresponds with when the user last provided input, and you have to compare that to the current tick to determine how long ago that was.

Xavi23cr has a good example for C# at codeproject.

Any suggestions for other environments?"

Asked by: Guest | Views: 382
Total answers/comments: 2
Guest [Entry]

"You seem to have answered your own question there Nathan ;-)
""GetLastInputInfo"" is the way to go.

One trick is that if your application is running on the desktop, and the user connects to a virtual machine, then GetLastInputInfo will report no activity (since there is no activity on the host machine).

This can be different to the behaviour you want, depending on how you wish to apply the user input."
Aruwui [Entry]

buy atorvastatin 80mg generic <a href="https://lipiws.top/">buy lipitor 10mg pills</a> order generic atorvastatin 80mg