Platform SDK: RAS/Routing and RAS |
The RasDialDlg function establishes a RAS connection using a specified phone-book entry and the credentials of the logged-on user. The function displays a stream of dialog boxes that indicate the state of the connection operation.
BOOL RasDialDlg( LPTSTR lpszPhonebook, // pointer to the full path and file name of // the phone-book file LPTSTR lpszEntry, // pointer to the name of the phone-book // entry to dial LPTSTR lpszPhoneNumber, // pointer to replacement phone number to // dial LPRASDIALDLG lpInfo // pointer to a structure that contains // additional parameters );
If the function establishes a RAS connection, the return value is a nonzero value.
If an error occurs, or if the user selects the Cancel button during the dialing operation, the return value is zero. If an error occurs, the dwError member of the RASDIALDLG structure returns a nonzero system or RAS error code.
The RasDialDlg function displays a series of dialog boxes that are similar to the dialog boxes that main Dial-Up Networking dialog box displays when the user selects the Dial button. The RasDialDlg function is useful for applications in which you want to display a standard user interface for a connection operation without presenting the main phone-book dialog box. For example, the RAS AutoDial service uses this function to establish a connection using the phone-book entry associated with a remote address.
The RasDialDlg function displays dialog boxes during the connection operation to provide feedback to the user about the progress of the operation. For example, the dialog boxes might indicate when the operation is dialing, when it is authenticating the user's credentials on the remote server, and so on. The dialog boxes also provide a Cancel button for the user to terminate the operation.
RasDialDlg returns when the connection is established, or when the user cancels the operation.
The following sample code dials the entry in the default phone-book specified by the variable lpszEntry.
lpInfo = (LPRASDIALDLG) GlobalAlloc(GPTR, sizeof(RASDIALDLG)); lpInfo->dwSize = sizeof(RASDIALDLG); printf("Dialing %s...\n", lpszEntry); // Calling RasDialDlg() nRet = RasDialDlg(NULL, lpszEntry, NULL, lpInfo); if (nRet == 0) { printf("RasDialDlg failed: Error = %d\n", lpInfo->dwError); } else { printf("Connection established.\n"); } GlobalFree(lpInfo);
Windows NT/2000: Requires Windows NT 4.0 or later.
Windows 95/98: Unsupported.
Header: Declared in Rasdlg.h.
Library: Use Rasdlg.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000.
Remote Access Service (RAS) Overview, Remote Access Service Functions, RASDIALDLG, RasPhonebookDlg