Solved

Window 95 installed modem COM port using.

Posted on 1997-08-15
5
192 Views
Last Modified: 2013-12-03
How to get window 95 installed modem configuration? Especially the COM port using by modem.  I know I can find configuration information in registry \HKEY_LOCAL_MACHINE\System\Class\Modem. But it is not working for all kind of modem. For external modem it is fine. For internal modems, most of time the COM port using information is missing. Please help.
0
Comment
Question by:hawyuan
  • 2
  • 2
5 Comments
 
LVL 4

Expert Comment

by:md041797
Comment Utility
Use CreateFile on \\.\COM1, 2, 3, 4 to get a handle on each port.  For each valid handle call GetCommProperties.  The COMMPROP.dwProvSubType will have PST_MODEM if a modem is attached.  You should avoid the registry for this kind of thing.  MS has said these locations are subject to change in the future.
0
 

Author Comment

by:hawyuan
Comment Utility
It is not working. The COMMPROP.dwProvSubType I got always is PST_RS232. Here is my testing program. Can you tell my anything wrong?

HANDLE  hComDev ;
BOOL    bRet ;
COMMPROP  CommProp ;

hComDev = CreateFile( "COM2",GENERIC_READ|GENERIC_WRITE,
                  0,                    // exclusive access
                  NULL,                 // no security attrs
                  OPEN_EXISTING,
                  FILE_ATTRIBUTE_NORMAL |
                  FILE_FLAG_OVERLAPPED, // overlapped I/O
                  NULL ) ;

bRet = GetCommProperties(hComDev,(LPCOMMPROP)&CommProp ) ;

I am trying to show user and let user select the modem they installed by using the modem option in control panel. In order to do this, I have to get the modem name and the COM port using.

0
 
LVL 4

Expert Comment

by:md041797
Comment Utility
No, I don't know why this does not work.  My solution is probably the wrong way to do this.
0
 

Accepted Solution

by:
YZ earned 200 total points
Comment Utility
All above mentioned approaches wonnt work if COM port being used
when you doing CreateFile(...) (it will return ACCESS_DENIED).
Anyway, this can be a sign that COM port really present in system, so just check for ACCESS_DENIED on return.

Second: How to get all installed modems in system ?
The answer is not easy: you shoud dig into RAS and TAPI.
If you interested, I can send you bunch of sources showing all
steps to get all modems/TAPI lines.

YZ.

0
 

Author Comment

by:hawyuan
Comment Utility
Yes, please send me sources codes to show the steps to get all modems/TAPI lines.

Here is my e-mail address: hawyuan@gpetech.com

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now