Connection Notification API
The Multiple Provider Router (MPR) calls the connection notification functions when it connects or disconnects a network resource. To receive such notifications, you can implement these functions in a DLL.
The MPR calls the AddConnectNotify function before and after attempting each add-connection operation (WNetAddConnection, WNetAddConnection2, or WNetAddConnection3). This function is not called when the MPR is automatically restoring network connections.
The MPR calls the CancelConnectNotify function before and after attempting each cancel-connection operation (WNetCancelConnection or WNetCancelConnection2).
For more information about WNet functions, see Windows Networking.
For more information about how to create and register an application that receives network connection notifications, see Receiving Connection Notifications and Registering to Receive Connection Notifications.