The RasEnumConnections function lists all active RAS connections. It returns each connection's handle and phone-book entry name.
DWORD RasEnumConnectionsA( LPRASCONNA , LPDWORD , LPDWORD );
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is from Routing and Remote Access Error Codes or Winerror.h.
||The lprasconn buffer is not large enough. The lpcbparameter is less than the dwSize member in the lprasconnparameter which is should be set prior to calling the function. The function returns the required buffer size in the variable pointed to by lpcb.|
If a connection was made without specifying a phone-book entry name, the information returned for that connection gives the connection phone number preceded by ".".
The following code sample code uses RasEnumConnections to enumerates the active RAS connections.
#include <windows.h> #include <stdio.h> #include "ras.h" #include "raserror.h" #pragma comment(lib, "rasapi32.lib")
Windows Me/98/95: RasEnumConnections enumerates a connection as Active as soon as it starts dialing.
The most reliable way to enumerate and check for an active connection is to call <b>RasEnumConnections</b> or <a href="https://msdn.microsoft.com/579a9038-8216-4948-a065-fd45b97da73a">RasDial</a> to get a connection handle, then call <a href="https://msdn.microsoft.com/3b2a2f8d-b1ff-44d2-ba49-60877ca6c104">RasGetConnectStatus</a> to determine the actual connection state.
|Windows version||Windows 2000 Professional [desktop apps only] Windows 2000 Server [desktop apps only]|