Notification Handlers
An asynchronous RasDial call must specify a notification handler. During an asynchronous connection operation, the Remote Access Connection Manager uses the notification handler to inform the RAS client whenever the connection state changes or an error occurs.
The actions performed by a notification handler can be divided into the following categories:
- Handling errors.
- Providing feedback to the user as the connection operation proceeds through the various connection states. See Informational Notifications.
- Handling paused states.
- Signaling the RAS client application when the connection operation has been completed. See Completion Notifications.
There are three types of notification handlers, each of which receives the same basic information: the current connection state and an error code that is nonzero only if an error has occurred.
Value | Definition |
---|---|
RasDialFunc | A callback function prototype that receives only the current connection state and error code information. |
RasDialFunc1 | A callback function prototype that receives the HRASCONN connection handle and extended error information in addition to the basic information. The connection handle parameter makes RasDialFunc1 useful for client applications that support multiple simultaneous connection operations. This allows the client to specify the same callback function for all operations, and enables the callback function to determine which connection is changing states. |
RasDialFunc2 | A callback function similar to RasDialFunc1. However, RasDialFunc2 is enhanced to support multilink connections. |
Window handle | A window handle to which RAS sends WM_RASDIALEVENT messages containing the current connection state and error code information. Use this method if your source code must be compatible with 16-bit Windows, because 16-bit Windows does not support either of the callback functions. |
The Remote Access Connection Manager suspends the connection operation until the notification handler returns. For this reason, the handler should return as soon as possible unless an error has occurred.
The RasDial function should not be called from within a notification handler. The other remote access functions ( RasGetConnectStatus, RasEnumEntries, RasEnumConnections, RasGetErrorString, and RasHangUp) can be called from within a handler.