Click here to Skip to main content
Click here to Skip to main content

Internet dialup program

, 2 Dec 1999
Rate this:
Please Sign up or sign in to vote.
A dial-up dialer for connection to Internet providers

Sample Image - afdialer.jpg

Introduction

I have written dial-up dialer for connection to Internet providers. This is a simple little program that dials your modem and tracks your online time. It also allows the user to setup multiple dial in numbers and gives the user a basic settings screen.

The sourcecode is freeware and can be distributed under terms of GPL. It is written in Visual C++ with use of MFC, RAS API and several other APIs like Performance Counters and multimedia API. Contact me if you have any suggestions on this software (lamer2000@hotmail.com) or on this article (alexander.fedorov@usa.net).

Latest update

The latest version of the project can be found here - http://win32utils.com/afd/

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

Alexander Fedorov
Web Developer SEO
Russian Federation Russian Federation
AlexF's Blog in Russian
Owner Spy competition analysis
Rating Burner Rating of blogs

Comments and Discussions

 
QuestionProgrmatically Creating New Modem PinmemberRangaraman12-Jul-12 4:33 
GeneralMy vote of 5 Pinmemberr0ediPell1-Jul-10 17:29 
Questionwhat version of compiler was used. I've tried to compile under Version 7 and 8 of Visual Studio no luck PinmemberACPR4839-Apr-08 10:21 
Generalsolved: RasEnumEntries() working in W2k/XP (code attached) PinmemberFrank Rysanek25-Sep-06 5:10 
Hello everyone,

the original code wrapped around RasEnumEntries() contained several bugs.
Specifically, it didn't properly distinguish the following:
1) RAS phonebook entry size, i.e. sizeof(struct ...)
2) RasEnumEntries() buffer size, i.e. the malloc() argument

buffer_size = entry_size * number_of_entries

Note that entry_size is passed into RasEnumEntries() via
entry->dwSize, whereas buffer size and number of entries
are passed in via the function prototype (by pointer).

The initial call to RasEnumEntries() will check entry->dwSize
and buffer size. It may report *two different* errors:
the entry size can be wrong, or the buffer can be too small
for all the entries. In either case, it will return the following:
1) the correct buffer size
2) the correct number of entries
via the arguments "passed by pointer" through the prototype.
Can't say if it also modifies the entry->dwSize - for the
second try, I'm setting it to buffer_size / number_of_entries,
just in case.

As a side note, the buffer size was originally initialized to
sizeof(DWORD), rather than sizeof(phonebook_entry) Smile | :)

The following code snippet should be obvious enough.
I've compiled that as a console proggie with gcc/mingw,
but the code should be fairly portable to MSVC.

(CodeProject's editing system seems to eat all empty lines - oh well...)

=========== SAMPLE CODE =============

bool GetPhonebookEntries()
{
   RASENTRYNAME* first_ras_entry; // really a buffer of [num_entries]
   DWORD buf_size, entry_size;
   DWORD num_entries = 1;
   DWORD retval;
   UINT  ndx;
   char  szMessage[256];
 
   entry_size = sizeof(RASENTRYNAME);
   buf_size = entry_size * num_entries;
   first_ras_entry = (LPRASENTRYNAME) new char[buf_size];
 
   // check for a malloc() failure
   if (NULL == first_ras_entry) return FALSE;
 
   // clear the whole buffer, rather than a single entry
   ZeroMemory(first_ras_entry, buf_size); // AKA bzero() or memset(0)
   first_ras_entry->dwSize = entry_size; // initialize the dwSize member
   retval = RasEnumEntries(NULL, NULL, first_ras_entry, &buf_size, &num_entries);
 
   if (
          (ERROR_BUFFER_TOO_SMALL == retval) // entry size OK, but too many entries
       || (ERROR_INVALID_SIZE == retval) // entry size wrong
      )
   {
      entry_size = buf_size / num_entries; // recalculate the correct entry size
      
      // reallocate the buffer:
      delete first_ras_entry;
      first_ras_entry = NULL;
      first_ras_entry = (LPRASENTRYNAME) new char[buf_size];
      
      if (NULL != first_ras_entry) // if buffer OK, try again
      {
         ZeroMemory(first_ras_entry, buf_size);
         first_ras_entry->dwSize = entry_size;
         retval = RasEnumEntries(NULL, NULL, first_ras_entry, &buf_size, &num_entries);
      }
      else
         retval = ERROR_NOT_ENOUGH_MEMORY;
   }
 
   if (0 != retval) // other error
   {
      long int tmp_retval;
      tmp_retval = RasGetErrorString((UINT)retval, szMessage, 256);
      if (0 == tmp_retval)
      {
         printf("%s\n", szMessage);
      }
      else
         printf("Couldn't get a verbose err. message. RasGetErrorString() = %ld", tmp_retval);
   }
 
   if (0 == num_entries)
   {
      delete first_ras_entry ;
      return FALSE;
   }
 
   if (0 == retval)  // No errors
   {
      for (ndx = 0; ndx < num_entries; ndx++)
      {
         printf("Found a RAS entry: %s\n", first_ras_entry[ndx].szEntryName);
      }
   }
 
   delete first_ras_entry;
   return TRUE;
}

GeneralRe: solved: RasEnumEntries() working in W2k/XP (code attached) PinmemberTamnn21-Dec-09 0:49 
GeneralRe: solved: RasEnumEntries() working in W2k/XP (code attached) PinmemberFrank Rysanek21-Dec-09 6:10 
GeneralRe: solved: RasEnumEntries() working in W2k/XP (code attached) PinmemberTamnn23-Dec-09 6:04 
GeneralRe: solved: RasEnumEntries() working in W2k/XP (code attached) PinmemberFrank Rysanek23-Dec-09 11:02 
GeneralPlease Help:Cannot find the phone book error Pinmemberzalmay31-Aug-05 22:37 
GeneralCannot find the phone book entry Pinmemberaquintaba22-Aug-05 1:14 
GeneralBad Link PinmemberKevin.Xue18-Apr-05 0:01 
GeneralRe: Bad Link PinmemberAlexander Fedorov19-Apr-05 9:24 
GeneralBad links PinstaffNishant S21-Mar-05 21:10 
GeneralRe: Bad links PinmemberAlexander Fedorov19-Apr-05 9:24 
GeneralSound effects PinmemberNguyen Van Thuan9-Sep-04 18:59 
QuestionWhat is the appropriate RASENTRYNAME structure to work on all windows? Pinmembermfc_surfer18-Dec-03 2:53 
AnswerRe: What is the appropriate RASENTRYNAME structure to work on all windows? PinmemberAswathy K R28-Feb-06 5:32 
GeneralProblem in win98 Pinmemberno_body6925-Jun-03 2:59 
QuestionHow to get device ID Pinmemberguostong19-May-03 20:13 
QuestionHow to decrease size PinsussLara Suji10-Mar-03 20:15 
GeneralNot working under Win 2K PinmemberParas27-Feb-03 22:34 
GeneralRe: Not working under Win 2K PinmemberAlexander Fedorov28-Feb-03 2:04 
QuestionWhere is the latest source code? PinsussAnonymous6-Nov-02 18:05 
AnswerRe: Where is the latest source code? PinmemberAlexander Fedorov7-Nov-02 5:42 
GeneralHelp PinsussAji Varghese25-Jul-02 19:43 
Generalchecking if the line is avaliable PinsussAnonymous11-Jul-02 8:41 
GeneralRe: checking if the line is avaliable PinmemberTili18-Jul-02 17:03 
GeneralDial Up Program does not work in Win 98 SE PinmemberArkadiusz Bicz9-Jun-02 5:29 
GeneralRe: Dial Up Program does not work in Win 98 SE Pinmemberno_body6926-Jun-03 1:23 
Generalone bug PinmemberAnonymous5-Jun-02 17:19 
GeneralFox 4 W2K PinmemberAnonymous12-Mar-02 23:14 
QuestionWhat if i dial the phone # ¶ÌÈ©¥ PinmemberAnonymous21-Feb-02 19:53 
GeneralPlease share the good source files or delete it PinmemberMiguelon1-Feb-02 7:12 
Generaldont know the last signal to connect to net Pinmemberrobin mukherjee13-Nov-01 21:31 
Generalmaking phone call through modem using visual c++ programming PinmemberTian Ek3-Sep-01 1:58 
GeneralRe: making phone call through modem using visual c++ programming PinmemberMichael P Butler3-Sep-01 2:44 
Questionwhere is the lastest version? PinmemberAnonymous21-Jun-01 18:37 
GeneralYour source code is totally unusable! PinmemberErvin Lancker20-May-01 6:37 
GeneralRe: Your source code is totally unusable! PinmemberAlexander Fedorov20-May-01 16:12 
GeneralRe: Your source code is totally unusable! PinmemberJohn Wong20-Jan-02 15:52 
GeneralSending files using modem PinmemberD.D. de Kerf1-May-01 0:12 
GeneralRe: Sending files using modem PinmemberD.D. de Kerf4-Jun-01 22:32 
GeneralRe: Sending files using modem PinsussAnonymous16-Apr-03 17:51 
QuestionHow to use DUN User Name and Password PinmemberJohn Tan Jin Kiat23-Apr-01 20:17 
Generalevent log full when run it under win2k PinmemberAnonymous12-Mar-01 2:23 
GeneralSmall bug causing error message in W2K PinmemberAnonymous23-Jan-01 19:42 
GeneralRe: Small bug causing error message in W2K PinmemberAnonymous14-May-01 12:28 
GeneralCan't read it. PinmemberUzzy B20-Dec-00 7:34 
GeneralRe: Can't read it. PinmemberAnthony Yio5-Dec-01 18:00 
Generalquerry Pinsussryan sanchez27-Apr-00 1:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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
Web01 | 2.8.150331.1 | Last Updated 3 Dec 1999
Article Copyright 1999 by Alexander Fedorov
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid