用户按键/鼠标输入跟踪。 C#

发布于 2024-07-17 01:40:53 字数 237 浏览 10 评论 0原文

我想追踪我离开键盘多久/我休息了多久。 我认为跟踪我的键盘和鼠标是了解我何时离开和到达的好方法。 跟踪这个的最好方法是什么? 我看到的一些选项

  • 对于每次按下鼠标和键盘都有一个系统范围的回调。
  • 休眠 100 毫秒,看看是否有按键或鼠标移动
  • 使用一个系统调用来实际告诉我最后一次用户输入是什么时候,并有效地使用上述组合。 (休眠直到用户离开,然后使用回调来跟踪到达)

I want to track how long i been away from my keyboard/how long i took a break. I figure tracking my keyboard and mouse is a good way to see when i left and arrived. Whats the best way to track this? Some options i see

  • Have a system wide callback for every mouse and keyboard press.
  • Sleep for a 100ms and see if there is a keydown or mousemovent
  • Use a system call that actually tells me when the last userinput was and use a combo of the above for efficiently. (sleep until user is away, then use callback to track arrival)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

轻许诺言 2024-07-24 01:40:53

尝试查看

您不需要自己进行跟踪,看起来您可以进行系统调用来获取空闲时间。

Try looking at this.

You shouldn't need to do the tracking yourself, it looks like you can do system calls to get the idle time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文