.NET相当于GetLastInputInfo?NET、GetLastInputInfo

2023-09-04 00:26:20 作者:Ellis 埃利斯

有相当于Windows的 GetLastInputInfo() API?

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

我知道这是可能的P / Invoke的API,但我在找一个方法或技术,这已经内置在.NET框架。

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.

推荐答案

没有在.NET基础类库的特定API的直接翻译。幸运的是,这是一个很简单的方法来的P / Invoke 。

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

话虽这么说,还有其他的方法来尝试检查用户空闲状态。大都需要的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).

下面是比较选项的 $ C $的CProject的文章。

Here is a CodeProject article comparing options.