Solved

Window 95 installed modem COM port using.

Posted on 1997-08-15
5
200 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

624 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