Programmatically Create Dialup Connection Objects

Environment: This code has been successfully tested under Windows 9x and Windows NT


CRasAbsLay is a simple class that encapsulates the functionality that you need from RAS to be able to create dialup connections in your Dialup connection folder. You cannot assume that all the machines have the RAS services available and you cannot link the RAS API library statically to your application, that's the reason why use the object CRas instead of calling the API directly.

I wrote this class when I wrote a installation program from an ISP that setup your Dialup Network with their connection settings.

Integrating the Code in Your Application

  1. Add  RasAbsLay.cpp and RasAbsLay.h to your project
  2. If you are not already including afxtempl.h, add it to your stdafx.h file
  3. Call CreatePhoneBookEntry member to create your connection

The Demo Project

The example code is a dialog-based application that prompts the user for information regarding its connection and creates the proper dial-up settings.


Download demo project - 15 Kb


  • Need a small help[ windows 98/95]

    Posted by Legacy on 01/23/2004 12:00am

    Originally posted by: Big D

    Thank you very much Jordi Mas...

    Need a small help.I hv created a com using ur code, tested in xp,2k prof. While testing in windows 98,i encountered a error in setting SetEntryProperties.

    Is there any specific RASENTRY parameter settings for windows 98 ? I also need to use it in windows 95.

    Thanx again for goin through my request. I mm tryin to find the problem.

    Expecting ur comment on this.


    Big D

  • Problem with setting Login/Password under NT

    Posted by Legacy on 06/29/2003 12:00am

    Originally posted by: Alexander McCooke

    I am trying to use RasSetEntryDialParams() to specify a user name and password so the user won't be prompted when they dial. This works as expected under Windows NT SP6a and Windows 2000, but under NT SP3, SP4 and SP5 this function call does not appear to do anything - the standard user name/password dialog appears with the user name defaulting to the user's NT user name (not the one I specified in the function call).

    Does anyone know of a workaround?

    Another curious "feature" - when creating a phonebook entry under Windows 95, setting RASEO_TerminalAfterDial brings up a terminal windows *before* dialing and RASEO_TerminalBeforeDial brings up a window *afterwards*. Works as expected under Windows NT.

  • and unicode

    Posted by Legacy on 03/26/2003 12:00am

    Originally posted by: baroukh

    are you testing your code in unicode

  • simple question with country-code

    Posted by Legacy on 03/06/2003 12:00am

    Originally posted by: claude bisdorff

    Hello, I have just a little question with the CreatePhoneBookentry-Function.
    You set rasEntry.CountryCode=34

    In fact, is this the national prefix that will be set?
    If I dont want to set a national prefix, can I leave this line away?WIll the connection still work?

    Thanx a lot

    Claude Bisdorff

  • I need a VB way

    Posted by Legacy on 05/23/2002 12:00am

    Originally posted by: Osama

    I am VB and Delphi Programmer and I need a way to do what is done here with in the environments I work proffesionally on it

  • n/a

    Posted by Legacy on 05/08/2002 12:00am

    Originally posted by: Paul

    Excellent work!

    Finally someone has been so nice as to reveal Microsofts secrets in DUN. Trying to keep the default dialogs silent has long been one of my needs.

    Now if I can just figure out how to port stdafx.h to C++ Builder I'm set.

    Peace out~

  • How to use the whole code in MS Visual C++???

    Posted by Legacy on 03/28/2002 12:00am

    Originally posted by: Peter Young


    I just downloaded that code. How do I just grab whats there and make it a self-executable file. I can't for the life of me figure it out in visual c++.

    Just want to change the ip addresses and add a phone number. Then just make it an exe.

    Thanks for any help,

    [ stingray ]

  • RasSetEntryProperties returns 632

    Posted by Legacy on 02/20/2002 12:00am

    Originally posted by: Lau


    I downloaded and compiled the sample. When I tried to create a new dial up connection, it said "unable to create..." and RasSetEntryProperties() returned an error code 632. The PhoneEntry sample in SDK runs fine though. Please help. Thanks

  • How to I add static dial-up IP address to this app.?

    Posted by Legacy on 12/27/2001 12:00am

    Originally posted by: BUGRA GUMUS

    I wanna create a dial-up connection but my ISP will not assign an IP address automaticly ; I will write IP address assigned to me staticly to my dial-up client.

    So by using this program how I handle this?


  • How do I run this connection from my applikation?

    Posted by Legacy on 07/30/2000 12:00am

    Originally posted by: Ferdinando

    How can I run the Dialup Connection in my App automaticly?
    I found out, that the connection is registerd in:
    but I don�t know where the file is to find and how to start it in my VC-App.

    The second question is: After starting the Dialup connection automaticly the user must click ok. How can I "click" the ok button automaticly in my app, or how can I send the OnOK Message to the connection?

    Perhaps there is an easier way to start this connection without open it regulary?

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Anthony Christie, the Chief Marketing Officer for Level Communications, is responsible for customer experience, worldwide marketing and product management. In this informative asset, he shares his insights into why a private network connection to cloud-bases applications is the right decision for your enterprise. Download now to find out more.

  • Enterprises are increasingly looking to platform as a service (PaaS) to lower their costs and speed their time to market for new applications. Developing, deploying, and managing applications in the cloud eliminates the time and expense of managing a physical infrastructure to support them. PaaS offerings must deliver additional long-term benefits, such as a lower total cost of ownership (TCO), rapid scalability, and ease of integration, all while providing robust security and availability. This report …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date