Hello @Harshithraj1871 ,
Welcome to Microsoft Q&A!
You can use Event NetworkInformation.NetworkStatusChanged.
public MainWindow()
{
this.InitializeComponent();
NetworkInformation.NetworkStatusChanged += NetworkStatusChanged;
}
private void NetworkStatusChanged(object sender)
{
Debug.WriteLine("NetworkStatusChanged");
}
I remember that your project is Winui3 C++, the following information is for your reference.
1.INetworkEvents::NetworkConnectivityChanged
The NetworkConnectivityChanged
method is called when network connectivity related changes occur.
2.Receiving Event Notifications Through WMI
Thank you.
Junjie
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.