C#代码检查操作系统是否进入空闲状态? [英] c# code to check if OS has entered idle state or not?
本文介绍了C#代码检查操作系统是否进入空闲状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请让我知道它们是否是API或我可以用来检查系统是否进入空闲状态的任何其他方法?
Hi,
Please let me know if they are any APIs or any other methods by which i can check if the system has entered idle state or not?
推荐答案
签出 SystemEvents.PowerModeChanged [ PowerModeChangedEventArgs [
Check out SystemEvents.PowerModeChanged[^] event and info from PowerModeChangedEventArgs[^]
IFAIK,否:考虑一下-如果操作系统处于空闲状态,您用来检查运行的代码如何运行?
IFAIK, no: think about it - if the OS is in the idle state, how is the code you are using to check running?
我不太确定您要使用空闲状态做什么还是空闲状态,但是user32.dll
e xports GetLastInputInfo [
I am not quite sure what you want to do with idleness or what you mean by idle but user32.dll
exports GetLastInputInfo[^] which you can check timely fashion to decide whether PC is idle or not. For instance, "2 minutes past since last user input, so I assume user is away from keyboard and this code will do blah blah".
这篇关于C#代码检查操作系统是否进入空闲状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文