Platform SDK: RAS/Routing and RAS

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
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
Specifies 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 4.0 and earlier versions only: If hrasconn is a handle to a combined multilink connection, hEvent is signaled when a subentry is connected.
RASCN_BandwidthRemoved Windows NT 4.0 and earlier versions 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.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 98.
  Header: Declared in Ras.h.
  Library: Use Rasapi32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000.

See Also

Remote Access Service (RAS) Overview, Remote Access Service Functions, CreateEvent, RasEnumConnections