RasConnectionNotificationA function (ras.h)

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


DWORD RasConnectionNotificationA(
       HRASCONN ,
       HANDLE   ,


[in] unnamedParam1

A handle to the RAS connection that receives the notifications. This can be a handle returned by the RasDial or RasEnumConnections function. If this parameter is INVALID_HANDLE_VALUE, notifications are received for all RAS connections on the local client.

[in] unnamedParam2

Specifies the handle of an event object. Use the CreateEvent function to create an event object.

[in] unnamedParam3

Specifies the RAS event that causes the system to signal the event object specified by the hEvent parameter. This parameter is a combination of the following values.

Value Meaning
If hrasconn is INVALID_HANDLE_VALUE, hEvent is signaled when any RAS connection is created.
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.
Windows NT:  If hrasconn is a handle to a combined multilink connection, hEvent is signaled when a subentry is connected.
Windows NT:  If hrasconn is a handle to a combined multilink connection, hEvent is signaled when a subentry is disconnected.

Return value

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is a non-zero error code from Routing and Remote Access Error Codes or Winerror.h.


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

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


The ras.h header defines RasConnectionNotification as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header ras.h
Library Rasapi32.lib
DLL Rasapi32.dll

See also



Remote Access Service (RAS) Overview

Remote Access Service Functions