Get Windows 7's network status

后端 未结 2 2031
青春惊慌失措
青春惊慌失措 2021-02-04 11:37

In Windows 7 whenever the internet access gets lost, the network indicator turns yellow. I want to get this status in my software and set an alarm whenever the internet connecti

相关标签:
2条回答
  • 2021-02-04 12:18

    In the Windows API Code Pack there is a NetworkManager class that gets you both IsConnected and IsConnectedToInternet. Comes with some useful samples too. If you want to detect a change in status, do not poll - there are .NET events you can add handlers for just like adding a click handler.

    Also see Detect Internet V. local lan connection, An elegant / simple way to check whether internet is available or not, I need a event to detect Internet connect/disconnect, etc.

    0 讨论(0)
  • 2021-02-04 12:23

    You could modify the network libary you found. Just look at the Network Interface Class. OperationalStatus can be more that up and down :)

    0 讨论(0)
提交回复
热议问题