Click here to Skip to main content
15,879,096 members
Articles / Desktop Programming / MFC
Article

Detecting and Installing Modem and RAS, Dial-up Network.

Rate me:
Please Sign up or sign in to vote.
3.60/5 (6 votes)
15 May 20022 min read 136.7K   4.2K   31   18
Detecting whether Modem and Dial-up Networking is installed in your system. If not, installing them programatically.

Introduction

This article discusses in detail how to detect whether any modem is present in your system. If not how to start the installation of the Modem programatically. It also detects whether RAS,DUN is already installed and if not how to start the installation of the same programatically.

Detecting and Installing Modem

To detect whether modem is present in your system, we have to check out the registry. If your OS version is Platform Win32 NT, ie, Windows NT or XP or 2000, then we have to open the key

HKEY_LOCAL_MACHINE,
  "SYSTEM\\CurrentControlSet\\Control\\Class\\"
  "{4D36E96D-E325-11CE-BFC1-08002BE10318}"
else if your OS version is Platform Win32 Windows, i.e., 9x or ME, then we have to open the key
HKEY_LOCAL_MACHINE,"System\\CurrentControlSet\\Services\\Class\\Modem"
and count the number of sub-keys under it. If any modem is present then the count will be greater than or equal to 1. If it is less than 1 then it means there is no modem present in the system.

To install the modem, just execute the Control Panel applet for Modem, and give the commannd line arguement as add, ie,

"rundll32.exe shell32.dll,Control_RunDLL Modem.cpl,,add",1

Detecting and Installing RAS or DUN

To detect whether RAS is installed in OS version Platform Win32 NT, try opening the registry key

HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\RemoteAccess"
if its successful, then RAS is already installed in your system. If its unsuccessful, then you can start the installation of the same by executing
rasphone.exe

To detect whether Dial-up Networking is installed in OS version Platform Win32 Windows, except Windows ME, try opening the registry key

HKEY_LOCAL_MACHINE,
   "System\\CurrentControlSet\\Services\\RemoteAccess\\NetworkProvider"
if its successful, then Dial-up is installed for Windows ME, open the registry key
HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\"
   "CurrentVersion\\Setup\\OptionalComponents\\RNA\\"
and query the value
"Installed"
if the value is 1 then Dial-up is installed.

Otherwise, install the same by executing

"rundll.exe setupx.dll,InstallHinfSection rna 0 rna.inf"

Conclusion

This is tested OK on all Windows OS. If you find any odd thing kindly let me know.

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
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

 
QuestionProgrmatically Creating New Modem Pin
Rangaraman12-Jul-12 3:27
Rangaraman12-Jul-12 3:27 
QuestionGetting Baud rate using RAS api Pin
kumar_vinit25-Jul-06 21:29
kumar_vinit25-Jul-06 21:29 
AnswerRe: Getting Baud rate using RAS api Pin
daluu16-Oct-07 14:29
daluu16-Oct-07 14:29 
Generaldial-in connections Pin
Vicenç García-Altés9-Jun-05 23:07
sussVicenç García-Altés9-Jun-05 23:07 
Generaldial-in connections Pin
Vicenç García-Altés9-Jun-05 23:07
sussVicenç García-Altés9-Jun-05 23:07 
Generalrasphone.exe Pin
Anonymous11-May-05 0:33
Anonymous11-May-05 0:33 
GeneralQuery regarding dialing Pin
navinkaus27-Aug-04 22:50
navinkaus27-Aug-04 22:50 
QuestionAnybody help me? Pin
tinh muon phuong28-Aug-02 6:28
tinh muon phuong28-Aug-02 6:28 
AnswerRe: Anybody help me? Pin
abibok14-Jun-06 2:45
abibok14-Jun-06 2:45 
QuestionHow to detect modem in remote machine Pin
30-May-02 14:44
suss30-May-02 14:44 
GeneralOld entries... Pin
dandy7217-May-02 3:45
dandy7217-May-02 3:45 
GeneralRe: Old entries... Pin
Parasuraman SundarRajan22-May-02 21:03
Parasuraman SundarRajan22-May-02 21:03 
GeneralRe: Old entries... Pin
dandy7224-May-02 5:22
dandy7224-May-02 5:22 
GeneralRe: Old entries... Pin
27-May-02 1:30
suss27-May-02 1:30 
GeneralRe: Old entries... Pin
dandy7228-May-02 10:31
dandy7228-May-02 10:31 
GeneralRe: Old entries... Pin
28-May-02 19:58
suss28-May-02 19:58 
GeneralRe: Old entries... Pin
dandy7229-May-02 10:21
dandy7229-May-02 10:21 
GeneralRe: Old entries... Pin
coolvcguy25-Aug-03 11:32
coolvcguy25-Aug-03 11:32 
Yea..Your point is really valid.
I also want something that does real time modem detection.
So can u share any easy method or direction , i can detect that
there is modem really there and not just driver.

Thnx in advance..

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.