Get Sleep/Hibernate and Resume/Wakeup events in Visual Basic.NET

后端 未结 2 1913
心在旅途
心在旅途 2021-02-09 11:11

I have VB.NET app that communicates with some external server (maintains login sessions via Intranet), and I want to listen for Sleep/Hibernate events such that when it happens,

2条回答
  •  臣服心动
    2021-02-09 11:44

    try below:

    To restart the pc

    System.Diagnostics.Process.Start("Shutdown", " -r -t 00")
    

    To shutdown the pc

    System.Diagnostics.Process.Start("Shutdown", " -s -t 00")
    

提交回复
热议问题