Retrieving Modem Information | CodeGuru

Retrieving Modem Information

This article was contributed by Seain B. Conover. 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 […]

Written By
CodeGuru Staff
CodeGuru Staff
Aug 18, 1999
1 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

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

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.