Click here to Skip to main content
12,502,104 members (53,566 online)
Click here to Skip to main content
Add your own
alternative version


23 bookmarked

Showing Dial-up Connection Status Window

, 4 Dec 2001
Rate this:
Please Sign up or sign in to vote.
How to invoke Dial-up Connection status window programatically by Sundar & Naresh

Sample Image - Connectionstatus.jpg


After dialing thru modem and connecting to Internet, we check the status of the connection by invoking the connection status window. This article describes how to invoke the connection status window programatically.In Windows 95,98 and NT it's very simple to invoke the same. Whereas in Windows XP and Windows 2000 we have write our own code to do the same.


In Windows NT, we can show this window by means of control panel file Rascpl.cpl. The method is as follows :

WinExec("rundll32.exe shell32.dll,Control_RunDLL Rascpl.cpl,,5",1);

In Windows 9x, say for example the profile which we use to connect to Internet thru dial-up networking is 'Netlink '. Then after the connection is established the connection status window's title will be "Connected to Netlink". So make use of the FindWindow function to invoke the status window. The method is as follows :

if(FindWindow(NULL,"Connected to Netlink"))
    FindWindow(NULL,"Connected to Netlink")->ShowWindow(1);

In Windows XP and Windows 2000, this is not the case, so we have to write our own code get the connection status. For this we need to use the API RasGetConnectionStatistics and RAS_STATS structure. But the problem with this API and structure are, though they are present in the rasapi32.lib they are not declared in the ras.h header file. So, we must use the LoadLibray method and GetProcAddress function to use the library and the function. And the RAS_STATS structure must be defined as follows :

typedef struct _RAS_STATS 
DWORD dwSize;
DWORD dwBytesXmited; 
DWORD dwBytesRcved;
DWORD dwFramesXmited; 
DWORD dwFramesRcved; 
DWORD dwCrcErr; 
DWORD dwTimeoutErr; 
DWORD dwAlignmentErr; 
DWORD dwHardwareOverrunErr; 
DWORD dwFramingErr; 
DWORD dwBufferOverrunErr; 
DWORD dwCompressionRatioIn; 
DWORD dwCompressionRatioOut; 
DWORD dwBps; 
DWORD dwConnectDuration; 


The Source file and the demo file include here to show the connection status are strictly for Windows XP and Windows 2000. So the Pseudocode for showing the connection status window for the appropriate OS is as follows :

If (OS == IsWin9x())
  if(FindWindow(NULL,"Connected to Netlink"))
    FindWindow(NULL,"Connected to Netlink")->ShowWindow(1);
else If (OS == IsWinNT())
  WinExec("rundll32.exe shell32.dll,Control_RunDLL Rascpl.cpl,,5",1); 
if(OS == IsWinXP() || OS == IsWin2k())
    //Connectionstatus.exe is attached with the demo file included here.


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


About the Author

Parasuraman SundarRajan
Web Developer
India India
Sundar is having 6 years of experience in VC++. and .NET for 2+ year. Has developed the Internet Dialer for Asia's No.1 leading ISP. Involved in developing Video Surveillance components for worlds leading Security Surveillance Software Company. Worked and working on various domains such as Internet Networking, Video Codecs, CCTV Surveillance Software, Video Portals, Windows Mobile, PDAs etc. Also working on various projects which involves RAS, TCP/IP, FTP, COM, XML, .NET, Remoting, Embedded programming.

You may also be interested in...


Comments and Discussions

GeneralExtract/read connection status from window with GUI automation Pin
daluu17-Oct-07 12:56
memberdaluu17-Oct-07 12:56 
QuestionHow to simply query for RAS connection speed? Pin
daluu16-Oct-07 15:59
memberdaluu16-Oct-07 15:59 
GeneralRAS and "Which Port" Pin
Emily J.27-Mar-06 20:11
memberEmily J.27-Mar-06 20:11 
GeneralIncorrect Members Values in RAS_STATS Pin
jt_roxas4-Feb-06 7:15
memberjt_roxas4-Feb-06 7:15 
QuestionCan't understand why to use this form? Pin
NeutronMass5-Feb-05 11:40
memberNeutronMass5-Feb-05 11:40 
AnswerRe: Can't understand why to use this form? Pin
ThatsAlok1-Jun-05 23:39
memberThatsAlok1-Jun-05 23:39 
General[Message Deleted] Pin
Ramadan DERVISHI19-Nov-03 3:15
sussRamadan DERVISHI19-Nov-03 3:15 
QuestionCould you tall me why show this error? Pin
no_body6925-Jun-03 0:30
memberno_body6925-Jun-03 0:30 
AnswerRe: Could you tall me why show this error? Pin
ThatsAlok9-Jan-05 17:56
memberThatsAlok9-Jan-05 17:56 
GeneralRe: Could you tall me why show this error? Pin
Tieter7-Feb-06 9:03
memberTieter7-Feb-06 9:03 
GeneralRe: Could you tall me why show this error? Pin
ThatsAlok8-Feb-06 17:57
memberThatsAlok8-Feb-06 17:57 
AnswerRe: Could you tall me why show this error? Pin
Shashikant_200629-Jun-06 2:33
memberShashikant_200629-Jun-06 2:33 
GeneralRe: Could you tall me why show this error? Pin
lipper10-Jun-08 16:55
memberlipper10-Jun-08 16:55 

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.160919.1 | Last Updated 5 Dec 2001
Article Copyright 2001 by Parasuraman SundarRajan
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid