Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET equivalent for GetLastInputInfo?

Tags:

c#

.net

Is there a .NET equivalent to the Windows GetLastInputInfo() API?

I know it's possible to P/Invoke the API but I'm looking for a method or technique that's already built into the .NET framework.

like image 390
Jeff Stong Avatar asked Jul 01 '09 15:07

Jeff Stong


2 Answers

There isn't a direct translation of that specific API in the .NET BCL. Fortunately, it's a very easy method to P/Invoke.

That being said, there are other ways to attempt to check user idle state. Most still require P/Invoke at some level (at least all of the ones that handle other applications).

Here is a CodeProject article comparing options.

like image 175
Reed Copsey Avatar answered Oct 21 '22 00:10

Reed Copsey


If there isn't another call for this Pinvoke.net provides a P/Invoke solution for this call and necessary struct.

like image 38
Timothy Carter Avatar answered Oct 20 '22 23:10

Timothy Carter