Click here to Skip to main content
15,887,485 members
Articles / Desktop Programming / MFC
Article

Internet dialup program

Rate me:
Please Sign up or sign in to vote.
3.12/5 (16 votes)
2 Dec 1999 293.6K   10.7K   45   53
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


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

Comments and Discussions

 
QuestionProblem faced in Dial up connection Pin
ss1965 23-Nov-17 20:59
ss1965 23-Nov-17 20:59 
QuestionProgrmatically Creating New Modem Pin
Rangaraman12-Jul-12 3:33
Rangaraman12-Jul-12 3:33 
GeneralMy vote of 5 Pin
r0ediPell1-Jul-10 16:29
r0ediPell1-Jul-10 16:29 
Questionwhat version of compiler was used. I've tried to compile under Version 7 and 8 of Visual Studio no luck Pin
ACPR4839-Apr-08 9:21
ACPR4839-Apr-08 9:21 
Generalsolved: RasEnumEntries() working in W2k/XP (code attached) Pin
Frank Rysanek25-Sep-06 4:10
Frank Rysanek25-Sep-06 4: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) Pin
Tamnn20-Dec-09 23:49
Tamnn20-Dec-09 23:49 
GeneralRe: solved: RasEnumEntries() working in W2k/XP (code attached) Pin
Frank Rysanek21-Dec-09 5:10
Frank Rysanek21-Dec-09 5:10 
GeneralRe: solved: RasEnumEntries() working in W2k/XP (code attached) Pin
Tamnn23-Dec-09 5:04
Tamnn23-Dec-09 5:04 
GeneralRe: solved: RasEnumEntries() working in W2k/XP (code attached) Pin
Frank Rysanek23-Dec-09 10:02
Frank Rysanek23-Dec-09 10:02 
GeneralPlease Help:Cannot find the phone book error Pin
zalmay31-Aug-05 21:37
zalmay31-Aug-05 21:37 
GeneralCannot find the phone book entry Pin
aquintaba22-Aug-05 0:14
aquintaba22-Aug-05 0:14 
GeneralBad Link Pin
Kevin.Xue17-Apr-05 23:01
Kevin.Xue17-Apr-05 23:01 
GeneralRe: Bad Link Pin
Alexander Fedorov19-Apr-05 8:24
Alexander Fedorov19-Apr-05 8:24 
GeneralBad links Pin
Nish Nishant21-Mar-05 20:10
sitebuilderNish Nishant21-Mar-05 20:10 
GeneralRe: Bad links Pin
Alexander Fedorov19-Apr-05 8:24
Alexander Fedorov19-Apr-05 8:24 
GeneralSound effects Pin
Member 12215509-Sep-04 17:59
Member 12215509-Sep-04 17:59 
QuestionWhat is the appropriate RASENTRYNAME structure to work on all windows? Pin
mfc_surfer18-Dec-03 1:53
mfc_surfer18-Dec-03 1:53 
AnswerRe: What is the appropriate RASENTRYNAME structure to work on all windows? Pin
Aswathy K R28-Feb-06 4:32
Aswathy K R28-Feb-06 4:32 
GeneralProblem in win98 Pin
no_body6925-Jun-03 1:59
no_body6925-Jun-03 1:59 
QuestionHow to get device ID Pin
guostong19-May-03 19:13
guostong19-May-03 19:13 
QuestionHow to decrease size Pin
Lara Suji10-Mar-03 19:15
sussLara Suji10-Mar-03 19:15 
GeneralNot working under Win 2K Pin
Paras27-Feb-03 21:34
Paras27-Feb-03 21:34 
GeneralRe: Not working under Win 2K Pin
Alexander Fedorov28-Feb-03 1:04
Alexander Fedorov28-Feb-03 1:04 
QuestionWhere is the latest source code? Pin
Anonymous6-Nov-02 17:05
Anonymous6-Nov-02 17:05 
AnswerRe: Where is the latest source code? Pin
Alexander Fedorov7-Nov-02 4:42
Alexander Fedorov7-Nov-02 4:42 

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.