Click here to Skip to main content
11,410,750 members (61,737 online)
Click here to Skip to main content

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

Introduction

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.

Implementation

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; 
} RAS_STATS, *PRAS_STATS;

Conclusion

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())
{
  WinExec("Connectionstatus.exe",1);
    //Connectionstatus.exe is attached with the demo file included here.
}

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

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.

Comments and Discussions

 
GeneralExtract/read connection status from window with GUI automation Pinmemberdaluu17-Oct-07 13:56 
QuestionHow to simply query for RAS connection speed? Pinmemberdaluu16-Oct-07 16:59 
GeneralRAS and "Which Port" PinmemberEmily J.27-Mar-06 21:11 
GeneralIncorrect Members Values in RAS_STATS Pinmemberjt_roxas4-Feb-06 8:15 
QuestionCan't understand why to use this form? PinmemberNeutronMass5-Feb-05 12:40 
AnswerRe: Can't understand why to use this form? PinmemberThatsAlok2-Jun-05 0:39 
General[Message Deleted] PinsussRamadan DERVISHI19-Nov-03 4:15 
QuestionCould you tall me why show this error? Pinmemberno_body6925-Jun-03 1:30 
AnswerRe: Could you tall me why show this error? PinmemberThatsAlok9-Jan-05 18:56 
GeneralRe: Could you tall me why show this error? PinmemberTieter7-Feb-06 10:03 
GeneralRe: Could you tall me why show this error? PinmemberThatsAlok8-Feb-06 18:57 
AnswerRe: Could you tall me why show this error? PinmemberShashikant_200629-Jun-06 3:33 
GeneralRe: Could you tall me why show this error? Pinmemberlipper10-Jun-08 17:55 

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