检测的WinForms空闲用户 [英] Detecting idle users in Winforms
本文介绍了检测的WinForms空闲用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想如果用户处于非活动状态5分钟,暂停我的计划。通过非活动我的意思是在这段时间并没有pressed自己的鼠标或键盘的(包括境外节目呢!)。任何出发点?
I'd like to pause my program if a user is inactive for 5 minutes. By inactive I mean hasn't pressed their mouse or their keyboard during that time (including outside the program too!). Any starting points?
推荐答案
在一个计时器你可以的P / Invoke <一个href=\"http://www.pinvoke.net/default.aspx/user32.getlastinputinfo\"><$c$c>GetLastInputInfo()$c$c>这将返回数毫秒因为输入的是从用户检测,所有过程在当前会话中。
Within a timer you could p/invoke GetLastInputInfo()
which will return the number ms since input was detected from the user, across all processes in the current session.
这篇关于检测的WinForms空闲用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文