Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking if the current user is active?

Tags:

c#

Windows Live Messenger, Skype, the indexing service in Windows and the screensaver functionality in Windows all have a way of detecting when the user moves his/her mouse, or uses his/her keyboard to detect when they are active, and when they are not.

Is there a Windows API used for detecting if the user is present at his PC? What about proximity sensor APIs in Windows 8? Or is it required for me to actually detect if the user moves his mouse or uses the keyboard through existing Windows APIs?

like image 974
Mathias Lykkegaard Lorenzen Avatar asked Dec 06 '25 10:12

Mathias Lykkegaard Lorenzen


1 Answers

I found a solution using this API.

http://www.pinvoke.net/default.aspx/user32.GetLastInputInfo

It delivered exactly what I needed.

like image 91
Mathias Lykkegaard Lorenzen Avatar answered Dec 08 '25 01:12

Mathias Lykkegaard Lorenzen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!