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

前端 未结 6 1178
野的像风
野的像风 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条回答
  •  执念已碎
    2020-12-03 03:49

    You can subscribe to NetworkChange.NetworkAvailabilityChanged and NetworkChange.NetworkAddressChanged.

    I generally start a two second timer so that I can resume network communications after being in sleep mode when it times out.

提交回复
热议问题