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

  • On-demand Event Event Date: September 17, 2014 Another day, another end-of-support deadline. You've heard enough about the hazards of not migrating to Windows Server 2008 or 2012. What you may not know is that there's plenty in it for you and your business, like increased automation and performance, time-saving technical features, and a lower total cost of ownership. Check out this webcast and join Rich Holmes, Pomeroy's practice director of virtualization, as he discusses the future state of your servers, …

  • On-demand Event Event Date: September 10, 2014 Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild." This loop of continuous delivery and continuous feedback is how the best mobile …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds