次の方法で共有


Receiving Connection Data (Windows Embedded CE 6.0)

1/6/2010

While connected to a remote access server, the application can use the RasEnumConnections function to receive data about existing device connections. The data for each connection includes a connection handle and the name of the phone-book entry used to establish the connection. You can use the connection handle in a call to the RasGetConnectStatus function get the current connection status. RasGetConnectStatus retrieves data on the current status of the specified remote access connection. An application can use RasGetConnectStatus to determine the status of the RasDial function. RASCONNSTATE specifies an enumerator value that indicates the current state of the RasDial connection process and determines which part of the RasDial function is currently executing. The application can call the RasGetConnectStatus function to determine the name and device type or if the device has successfully connected.

The following list is an example of status values available to the application:

  • A port is about to be opened.
  • A port has been opened successfully.
  • A device is about to be connected.
  • A device has connected successfully.
  • The authentication process is starting.

To get current status of an existing connection

  1. Call RasGetConnectStatus.

Receive Connection Data Example

The following code example shows how to get current status of an existing connection.

// Get the connection status.
RasStatus.dwSize = sizeof (RASCONNSTATUS);
dwReturn = RasGetConnectStatus (hRasConn, &RasStatus);

// If there is an error in getting the connection status
if (dwReturn)
{
  wsprintf (szBuffer, 
            TEXT("Failed getting connect status.\r\n")
            TEXT("Error (%ld)."), 
            dwReturn);
  MessageBox (hMainWnd, szBuffer, TEXT("Warning"), MB_OK);
  break;
}

See Also

Concepts

Sample Application
Connection Sequence
Connection States