C# - 检测最后用户交互的时间与操作系统 [英] C# - Detect time of last user interaction with the OS

查看:134
本文介绍了C# - 检测最后用户交互的时间与操作系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写需要检测的最后一次用户与他们的机器互动的小托盘应用程序,以确定它们是否处于闲置状态。

I'm writing a small tray application that needs to detect the last time a user interacted with their machine to determine if they're idle.

有没有什么办法来检索用户上次的移动鼠标的时候,命中关键或以任何方式与他们互动的机器?

Is there any way to retrieve the time a user last moved their mouse, hit a key or interacted in any way with their machine?

我想的Windows显然跟踪此来确定何时显示屏幕保护程序或断电等,因此我假设有检索这个自己一个Windows API?

I figure Windows obviously tracks this to determine when to display a screen saver or power down, etc, so I'm assuming there's a Windows API for retrieving this myself?

推荐答案

GetLastInputInfo 。在 PInvoke.net 记录。

这篇关于C# - 检测最后用户交互的时间与操作系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆