Solved

Window 95 installed modem COM port using.

Posted on 1997-08-15
5
197 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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 video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

710 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