以编程方式更改Windows电源设置 [英] Programmatically change Windows power settings

查看:210
本文介绍了以编程方式更改Windows电源设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能从接近的改变盖一台笔记本电脑的节电行为休眠/待机/关机的到的有所不为的.NET Framework中<? / p>

编辑:这样看来,将其值设置为待机和阻断从我的应用程序待机,可以检测盖关闭事件,这就是我真的很后。



我发现的这个问题它与检测箱盖关闭交易,但它归结为使用备用事件或编写驱动程序。


解决方案

是的,你可以使用WMI类。



看一看的这里介绍WMI



请注意,你也可以使用 Application.SetSuspendState ,但这种方法只允许您挂起或休眠。所以,我想这不符合您的需求...



关于盖子,似乎有的方式如果盖关闭或检测不...


Is it possible to change the power-saving behaviour of a laptop computer on lid close from hibernate/standby/shutdown to Do Nothing from the .NET Framework?

Edit: it would appear that by setting the value to Standby and blocking the standby from my application, the lid close event can be detected, which is what I'm really after.

I found this question which deals with detecting lid close, but it boils down to using a standby event or writing a driver.

解决方案

Yes, you can use the WMI classes.

Take a look here to an introduction to WMI

Note that you can also use Application.SetSuspendState, but this method only allows you to suspend or hibernate. So I guess it doesn't match your needs...

About the lid, there seems to be a way to detect if the lid is closed or not...

这篇关于以编程方式更改Windows电源设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆