Solved

Window 95 installed modem COM port using.

Posted on 1997-08-15
5
193 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
ID: 1404212
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
ID: 1404213
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
ID: 1404214
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
ID: 1404215
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
ID: 1404216
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

863 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

20 Experts available now in Live!

Get 1:1 Help Now