How can I know when Windows is going into/out of sleep or Hibernate mode?

前端 未结 6 1179
野的像风
野的像风 2020-12-03 03:20

Is it possible to subscribe to a Windows event that fires when Windows is going into or coming out of Sleep or Hibernate state?

I need my application to be made awar

6条回答
  •  旧时难觅i
    2020-12-03 03:31

    Microsoft.Win32.SystemEvents.PowerModeChanged event will give you this information. This event is available in all variants of the .NET framework released by Microsoft so far.

提交回复
热议问题