C# GetLastInputInfo()在后台服务中不起作用

c212610 2020-02-15 04:05:08
服务无法获取到系统空闲时间,导致程序进行不下去了,求大神指导
...全文
382 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
github_36000833 2020-02-15
  • 打赏
  • 举报
回复
后台服务,运行在Session 0, 用户桌面和用户程序,运行在Session 1,2,3等等。 根据GetLastInputInfo的参考(https://docs.microsoft.com/zh-cn/windows/win32/api/winuser/nf-winuser-getlastinputinfo), GetLastInputInfo不能跨Session。
docs.microsoft.com
... Rather, GetLastInputInfo provides session-specific user input information for only the session that invoked the function. ... 至不过,GetLastInputInfo仅为调用该函数的会话提供特定于会话的用户输入信息。

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧