Retrieving Modem Information

This article was contributed by Seain B. Conover.

Sample Image

Environment: VC6 SP2, NT4 SP5

Alright folks, this post is the result of probably a hundred email requests over the past few months, in response to my original inquiry about how to retrieve modem information. Now I'm sure 'ol BG and the boys would probably take a different approach, but this one works for me.

It's very simply really. Run the included sample exe (included in the ZIP archive) to see what I mean.


// number of modems in machine
const int GetModemCount() const;
			
// reset string
const CString GetModemResetString( const CString strName ) const;

// init string, with optional desired volume level specified
// error control on, compression on, hardward flow control, modulation CCITT, blind off, call setup fail timer, inactivity timer + if requested, includes  volume init
const CString GetModemInitString( const CString strName, const int nSpeakerVolume = -1 ) const;

// com port
const int GetModemComPort( const CString strName ) const;

// maximum bps as per control panel
const int GetModemBps( const CString strName ) const;

// fills CComboBoxBox with list of modem names
void FillComboBoxWithModemNames( CComboBox* pComboBox );

// fills CListBox control with list of modem names
void FillListBoxWithModemNames( CListBox* pListBox );

// first listed non-virtual modem name in registry
const CString GetFirstModemName() const;

// modem name based on index
const CString GetModemName( const int nIndex ) const;

// does modem have speaker
const BOOL GetModemHasSpeaker( const CString strName ) const;

// how many volume levels? 
const int GetModemVolumeLevelsCount( const CString strName ) const;

// is strName a valid modem?
const BOOL GetIsModem( const CString strName ) const;

Example Usage:


CModemInfo ModemInfo;
const CString strModemName = ModemInfo.GetFirstModemName();
const CString strInit = ModemInfo.GetModemInit( strModemName );
const int nComPort = ModemInfo.GetModemComPort( strModemName );

A more realistic usage of this class however, would be to use the member functions ::FillComboBoxWithModemNames() or ::FillListBoxWithModemNames() -- then once the user exits your modem setup window, you can retrieve the Initialization String, Com Port, and Maximum BPS using, based on the modem name they have selected.

Downloads

Download demo project (includes source) - 132 Kb

History



Comments

  • How to answer through headphone/mic to opposite client

    Posted by Legacy on 11/05/2003 12:00am

    Originally posted by: Jebin

    Actually i call the client by dialing from computer, i have written code for that, after getting response from opposite side i couldn't answer to that opponent, that means my voice is not transfering through modem to opponent phone.
    
    how to enable my headphone/mic. Please help immediately.
    Thank you

    • sammmm

      Posted by alagurajan on 03/07/2005 11:44pm

      ya i am also having the same problem some one plz replay soon

      Reply
    Reply
  • dial-up by modem

    Posted by Legacy on 05/24/2003 12:00am

    Originally posted by: pham ky thanh

    I want to build a program can auto dial by modem.
    In my program :
    -I can know status of modem includes: sended speed , recieved speed , transfered speed.
    -and more but I do not know what I should begin ?
    Please help me . Thank you very much .

    Reply
  • tel. number dissalow

    Posted by Legacy on 04/30/2003 12:00am

    Originally posted by: chm0d

    how can i forbid the modem calling another number except the one stated in the dialog box when on the net(dialup)? thnx

    Reply
  • How talk over tephone using modem and headphone/mic ? ? ?

    Posted by Legacy on 01/05/2003 12:00am

    Originally posted by: Pradyumna Kumar Jena

    dear sirs,
    i am using hayes commands to dial a telephone number. my connectivity is ok. but i am not able to talk using the headphone , connected to modem. but if i am using a telephone receiver connected parallally to the same modem , it is ok. but the problem is my program loose its control over the modem.
    please guide me. . . .
    With regards
    Pradyumna
    9810933342

    Reply
  • Retrieving Modem Information

    Posted by Legacy on 04/02/2002 12:00am

    Originally posted by: babar

    hello! i would like to know how the phone number of a client connecting to RAS can be obtained programatically!
    i need to implement a CLI system!

    Reply
  • So many questions, almost no answers!

    Posted by Legacy on 01/03/2002 12:00am

    Originally posted by: Aldamo

    Hi, people look for help, but nobody gives answers. Hey, gurus, where are you?

    Reply
  • HELP!!! HELP!!! HELP!!!!

    Posted by Legacy on 12/15/2001 12:00am

    Originally posted by: Henry Liu

    A question,please!
    My modem has finish the job of dialing process,but without PPP connection. And how can I use serial port connected with that modem to serve RAS dailing. How to config or replace some modules?

    Please
    Thanks

    Reply
  • How can I use computer as a answering machine

    Posted by Legacy on 09/29/2001 12:00am

    Originally posted by: Praveen Mohania


    I am working on a project which requires modem programming and aims at using computer as a answering machine.

    If there is any one who can help me in modem programming or who has any software on this topic please help me

    The project also requires an call identifier software which
    can detect the phone no. of the dialer If any one has a software on this or sorce code please help me. Language preference is VB or Vc++

    Reply
  • How can i receive data from modem

    Posted by Legacy on 09/26/2001 12:00am

    Originally posted by: Muthamil Selvam. T

    Now i am devleloping one project - automatic answering ,
    in that i need a program to recives a phone call, then user press a number from telephone, i must recive the number based on that i replay to that phone ( as a voice data),


    Guide me to develop this project

    Reply
  • I Need Your Help

    Posted by Legacy on 07/19/2001 12:00am

    Originally posted by: Md Elias

    I wants dialup with serialport communication source code.We wants to check 64kbps modem with rs-232 communication.First we have to dial with modem and after conntection is establised have send some data through same comport 1 and receive back the data.We have some problem with this testing.pls try to help

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Specialization and efficiency are always in need. Whether it's replacing an aging roof, getting a haircut, or tuning up a car, most seek the assistance of trusted experts. The same is true in the business world, where an increasing number of companies are seeking the help of others to administer their IT systems and services. This special edition of Unleashing IT highlights a new breed of IT caretaker -- Cisco Powered service providers -- and the business advantages and operational efficiencies they …

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds