Click here to Skip to main content
12,634,982 members (32,370 online)
Click here to Skip to main content
Add your own
alternative version

Stats

115.7K views
5.1K downloads
21 bookmarked
Posted

Creating Dialup Connections

, 29 Aug 2002
Rate this:
Please Sign up or sign in to vote.
Describes how to create a new phone-book entry, and set it up with the user profile.
<!---------------------------------------------------------------------------><!------------------------------- STEP 2 ---------------------------><!-- Include download and sample image information. -->

Sample Image

<!------------------------------- STEP 3 ---------------------------><!-- Add the article text. Please use simple formatting (

,

etc) -->

Introduction

Recently I worked on the dialup APIs, and I noticed that many people are having difficulty using some of the RAS functions. Here, I decided to present how to create a new phone-book entry. The key functions are RasSetEntryProperties() to create a phone-book entry, and RasSetEntryDialParams() to store the username and the password in it. There are a couple more RAS functions that are used, but I wrapped them in the very simple functions to show you how to use them correctly.

API Reference

CreateRasEntry

Use this function to create a new phone-book entry. 

BOOL CRasEntry::CreateRasEntry(CString strEntryName, RASENTRY &RasEntry);

Parameters

  • strEntryName: Specifies a string containing the phone-book entry to use to establish the connection.
  • RasEntry: RASENTRY structure that contains the new connection data to be associated with the phone-book entry specified by the strEntryName parameter.

EnumModem

Returns the name and type of all available RAS-capable devices.

BOOL CRasEntry::EnumModem(char *szDeviceType, CStringArray &strDevArray);

Parameters

  • szDeviceType: Specifies a RAS device type. These are the available types: RASDT_Modem, RASDT_Isdn, RASDT_X25, RASDT_Vpn, and RASDT_Pad. For the dialup connection, you should use RASDT_Modem ("modem").
  • strDevArray: If this function returns TRUE, strDevArray will contain the name of all the RAS devices.

GetCountryInfo

Retrieves country-specific dialing information from the Windows Telephony list of countries. Provide the country ID before calling this function. If the function succeeds, it returns the country ID.

DWORD CRasEntry::GetCountryInfo(DWORD dwCID, RASCTRYINFO &RasCTryInfo, char *szCountryName);

Parameters

  • dwCID: Specifies a string containing the phone-book entry to use to establish the connection.
  • RasCTryInfo: Specifies a string containing the user's user name.
  • szCountryName: Specifies a string containing the user's password.

In order to retrieve all the countries, create a while loop like this:

RASCTRYINFO RasCTryInfo;
char szCountryName[256];
DWORD dwCountryID = 1;
while(GetCountryInfo(dwCountryID, RasCTryInfo, szCountryName))
{
    dwCountryID = RasCTryInfo.dwNextCountryID;
}

SetEntryDialParams

Specifies the user name and the password for the specified phone-book entry.

BOOL CRasEntry::SetEntryDialParams(CString strEntryName, CString strUsername, CString strPassword, BOOL bRemovePassword);

Parameters

  • strEntryName: Specifies a string containing the phone-book entry to use to establish the connection.
  • strUsername: Specifies a string containing the user's user name.
  • strPassword: Specifies a string containing the user's password.
  • bRemovePassword: Indicates if the password needs to be stored. If bRemovePassword is TRUE, the password will not be saved.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Seiya Fujii
Web Developer
United States United States
No Biography provided

You may also be interested in...

Pro

Comments and Discussions

 
QuestionThe source code is unavailable Pin
pham phong9-Dec-13 21:23
memberpham phong9-Dec-13 21:23 
QuestionProgrmatically Creating New Modem Pin
Rangaraman12-Jul-12 4:34
memberRangaraman12-Jul-12 4:34 
GeneralTCP/IP service to modem by remote modem Pin
captainc/c++26-Jun-08 22:42
membercaptainc/c++26-Jun-08 22:42 
QuestionHow to configure the entry created by RAS? Pin
hizfp20-Nov-07 20:57
memberhizfp20-Nov-07 20:57 
NewsNice article but i am missing a little thing (standardgateway) Pin
SiHot27-Jul-07 4:00
memberSiHot27-Jul-07 4:00 
Questionthx fro the article,but how to setup a modem by 115200? Pin
7788yy7-May-07 1:07
member7788yy7-May-07 1:07 
Generalcreate a new phonebook entry Pin
userppp10-Sep-05 0:49
memberuserppp10-Sep-05 0:49 
General&quot;RasSetEntryProperties&quot; give error 632 Pin
mohsen nourian11-Dec-04 22:31
membermohsen nourian11-Dec-04 22:31 
GeneralRe: &quot;RasSetEntryProperties&quot; give error 632 Pin
mohsen nourian14-Dec-04 1:34
membermohsen nourian14-Dec-04 1:34 
GeneralRe: &quot;RasSetEntryProperties&quot; give error 632 Pin
Tuur P.3-Feb-05 3:58
memberTuur P.3-Feb-05 3:58 
GeneralRe: &quot;RasSetEntryProperties&quot; give error 632 Pin
drchandrao2pl6-Jul-05 0:13
memberdrchandrao2pl6-Jul-05 0:13 
GeneralRe: "RasSetEntryProperties" give error 632 Pin
Pascal PEYRE22-Dec-10 6:50
memberPascal PEYRE22-Dec-10 6:50 
Generalrequest Pin
mascovani15-Oct-04 23:49
membermascovani15-Oct-04 23:49 
GeneralRasEntry &amp; Win98 Pin
shoshana11-Jul-04 3:29
membershoshana11-Jul-04 3:29 
GeneralRe: RasEntry &amp; Win98 Pin
mohsen nourian11-Dec-04 22:19
membermohsen nourian11-Dec-04 22:19 
GeneralA Problem with RAS Entry Pin
shoshana6-May-04 8:09
membershoshana6-May-04 8:09 
GeneralRe: A Problem with RAS Entry Pin
Seiya Fujii6-May-04 8:12
memberSeiya Fujii6-May-04 8:12 
GeneralRe: A Problem with RAS Entry Pin
shoshana6-May-04 8:16
membershoshana6-May-04 8:16 
GeneralRe: A Problem with RAS Entry Pin
michael_PPCO7-Jul-04 9:04
membermichael_PPCO7-Jul-04 9:04 
GeneralRe: A Problem with RAS Entry Pin
shoshana7-Jul-04 12:09
membershoshana7-Jul-04 12:09 
GeneralGood article Pin
Nishant S18-Sep-03 2:24
editorNishant S18-Sep-03 2:24 
GeneralDisabling Multilink on Win2K. Pin
Tili18-Nov-02 1:58
memberTili18-Nov-02 1:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161208.2 | Last Updated 30 Aug 2002
Article Copyright 2002 by Seiya Fujii
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid