Hi,
Is there any way to detect the numbers of serial com port in my computer using visual basic ?
Thanks
Printable View
Hi,
Is there any way to detect the numbers of serial com port in my computer using visual basic ?
Thanks
Yes. You will be using MSCommControl 6.0 to do that. You can write code that will list all your comports in a list or combo box. You can also write code that returnes whether or not any of the ports are in use. MsCommControl was supplied with the Pro & Enterprise editions only. It was not included in the free and learning editions.Quote:
Originally Posted by part0
The simplest way would be to enumerate the values in the regisrty under:
HKEY_LOCAL_MACHINE\Hardware\DeviceMap\SerialComm
I believe that you can also enumerate them using WMI but that might be a bit of an overkill
I'm a bit Registry shy so I tend to stay away from those options. Off the top of my head I think you could write (with proper error handlers) code to loop through all your comports and execute a 'MSComm1.PortOpen = True' statement. Since Windows will return the error number for "Port not found", "Port In Use!", etc, you can handle all your errors or lack of them with a Select Case block.Quote:
Originally Posted by Doogle
I have a 'Find Ports' routine and will post it if I can find it.
Try this code. It's not cleaned up yet, but I think it's one direction for a none API alternative. :wave:
http://www.vbforums.com/showpost.php...5&postcount=21