检测电源状态变化 [英] detect power state change

查看:68
本文介绍了检测电源状态变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

检测Windows电源状态何时发生变化的最佳方法是什么?

What is the best way to detect when Windows power state is changing?

我需要根据计算机是否要进入待机/休眠/状态来执行一些操作。关闭

I need to preform some actions depending on whether the computer is going to Standby/Hibernate/Shut Down

推荐答案

SystemEvents.PowerModeChanged 事件应执行您想要的操作

The SystemEvents.PowerModeChanged event should do what you want

您可能还想查看 SystemInformation.PowerStatus 属性。

You might also want to check out the SystemInformation.PowerStatus property.

这篇关于检测电源状态变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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