RasConnectionNotification

The RasConnectionNotification function specifies an event object that the system sets to the signaled state when a RAS connection is created or terminated.

DWORD RasConnectionNotification(
  HRASCONN hrasconn,  // handle to a RAS connection
  HANDLE hEvent,      // handle to an event object
  DWORD dwFlags       // type of event to receive notifications for
);
 

Parameters

hrasconn
Specifies a handle to the RAS connection for which to receive notifications. This can be a handle returned by the RasDial or RasEnumConnections function. If this parameter is INVALID_HANDLE_VALUE, you receive notifications for all RAS connections on the local computer.
hEvent
Specifies the handle of an event object. Use the CreateEvent function to create an event object.
dwFlags
Indicates the RAS event that causes the system to signal the event object specified by the hEvent parameter. This parameter can be a combination of the following values.
Value Meaning
RASCN_Connection If hrasconn is INVALID_HANDLE_VALUE, hEvent is signaled when any RAS connection is created.
RASCN_Disconnection hEvent is signaled when the hrasconn connection is terminated. If hrasconn is a multilink connection, the event is signaled when all subentries are disconnected. If hrasconn is INVALID_HANDLE_VALUE, the event is signaled when any RAS connection is terminated.
RASCN_BandwidthAdded Windows NT only: If hrasconn is a handle to a combined multilink connection, hEvent is signaled when a subentry is connected.
RASCN_BandwidthRemoved Windows NT only: If hrasconn is a handle to a combined multilink connection, hEvent is signaled when a subentry is disconnected.

Return Values

If the function succeeds, the return value is zero.

If the function fails, the return value is a nonzero error code.

Remarks

To determine when the event object is signaled, use any of the wait functions.

When the event is signaled, you can use other RAS functions, such as RasEnumConnections, to get more information about the RAS connection that was created or terminated.

QuickInfo

  Windows NT: Requires version 4.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in ras.h.
  Import Library: Use rasapi32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.

See Also

Remote Access Service Overview, RAS Server Administration Functions, CreateEvent, RasEnumConnections