检测用户上次单击/移动/键入/任何内容的时间
我有一个 Windows vb.net 项目,它基于 20 分钟计时器偶尔进行“自动刷新”。我想避免任何类型的自动刷新...如果用户在过去 5 分钟内手动与程序进行了任何交互(鼠标移动、单击、击键等)。
我添加了一个全局变量“Dim g_LastActivity As Date
”,以便计时器可以检测到 5 分钟标记。
是否有地方可以放置我的“g_LastActivity = NOW
”行,以确保它会在任何用户活动期间发生?所有鼠标点击,所有按钮,所有鼠标移动,任何地方,所有击键,基本上一切。
或者有完全不同的方法吗?
I have a Windows vb.net project that does an occasional "auto refresh" based on a 20 minute timer. I want to avoid any type of auto-refresh... if the user has manually had any interaction with the program (mouse move, click, keystroke, anything) in the past 5 minutes.
I added a global variable "Dim g_LastActivity As Date
" so the timer can detect that 5 minute mark.
Is there some place to put my "g_LastActivity = NOW
" line that will ensure it will happen during ANY user activity? All mouse clicks, on all buttons, all mouse moves, anywhere, all keystrokes, basically EVERYTHING.
Or is there an entirely different way to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 Application.Idle 事件以看看它是否适合您的需求。
Look into Application.Idle event to see if it will fit your needs.