| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Driver Development Discussions on the development of drivers. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi All,
This is my first post in this forum. I have tried searching this forum to get answer to my question before posting. I would like ask that is there any process using which I can get the installed COM ports number with friendly name in windows system. The operating system would be Windows XP with service pack 1/2/3 and higher. I need to enumerate the installed non plug and play legacy com ports and display to the user for selection. Actually a device with RS232 interface would be communicating with the windows pc via RS232 ports. So my application need to find the available COM ports and connect to that for reading and writing. Can anybody tell me how can I enumerate the available COM ports? Another question is that the most of the recent laptops does not come up with RS232 / COM ports. Only USB ports available for serial communication, so I would like to ask that if I use an RS232 to USB converter hardware device do I have to connect to USB port or same RS232 port connection is needed? Thanks and Regards, Bidesh C/C++, Win32, COM developer |
|
#2
|
|||
|
|||
|
Re: Enumerating Non Plug and Play Legacy Com Ports
Hi Bidesh,
This isn't really a device driver question. You can enumerate installed COM ports from usermode. Microsoft MVP PJ Naughter has written a class for enumerating COM ports. You can find his class here: http://www.naughter.com/enumser.html I did not understand your second question. Best Wishes, -David Delaune |
|
#3
|
|||
|
|||
|
Re: Enumerating Non Plug and Play Legacy Com Ports
Hi Randor,
Thanks for your reply. My second question was if I did not find a DB9/COM port in any system and only USB ports are available then how would I read/write on COM port. I got the source code from www.naughter.com which is very helpful. There were plenty of ways mentioned to enumerate COM ports installed in a system. Is there any way using which I can determine that enumerated COM ports are being used by any application? Thanks again, Bidesh C/C++, Win32, COM developer |
|
#4
|
|||
|
|||
|
Re: Enumerating Non Plug and Play Legacy Com Ports
Quote:
If a device or driver object describes itself as a COM port then you should be able to use it. My old laptop did not have any DB9 connectors or a UART controller and I was able to use USB to serial adaptors. Your usermode application will not know the difference. Quote:
Well try opening the COM port with exclusive access and CreateFile() will fail and GetLastError() will return ERROR_ACCESS_DENIED if the COM port is in-use. Best Wishes, -David Delaune |
|
#5
|
|||
|
|||
|
Re: Enumerating Non Plug and Play Legacy Com Ports
Hi Randor,
Thank you very much. Now I would be able to enumerate and determine unused COM ports for my application. Thanks again. Regards, Bidesh C/C++, Win32, COM developer |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|