Some applications need to receive notification of connection events, either before the event, just after it occurs, or both. You can create a DLL to receive advance and after-the-fact notification of connection events.
An example of an application that needs to receive advance notification of a connection event is the Remote Access Service (RAS). RAS needs to be informed before a connection is made because it may be necessary to establish a modem connection before making the network connection.
Similarly, applications may need to clean up resources after the connection is made, therefore requiring a post-connection notification.
Applications interested in receiving advance and after-the-fact notification of connection events must supply a DLL that exports two functions, AddConnectNotify and CancelConnectNotify.
After you implement these functions, you must register your DLL as described in Registering to Receive Connection Notifications.
Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.
