473,322 Members | 1,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Find which COM ports are available on the machine?

Hi,

Can anyone tell me how to get a list of which COM ports are available on the
machine? I want to let the user choose from a dropdown list of COM1, COM2,
etc which port he has attached a device to. Can't find a way to get that
list.

thanks
Robb
Jul 21 '05 #1
1 1443
I figured it out...the code below will do it.

private ArrayList getCOMPortList()
{
RegistryKey comPortKey = Registry.LocalMachine.OpenSubKey(
"HARDWARE\\DEVICEMAP\\SERIALCOMM" );

string[] portNames = comPortKey.GetValueNames();

ArrayList comPorts = new ArrayList();

for( int x=0; x<portNames.Length; x++ )
{
string comPortValue = ( string )comPortKey.GetValue( portNames[ x ] );

comPorts.Add( comPortValue );
}

return comPorts;

}
Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Krunoslav Ostrouska | last post by:
How can i get a list of available COM Ports on a machine? Thanks
3
by: bwmiller16 | last post by:
Why are 2 ports required for a HADR Pair? Environment: RH Linux AS3 UDB Express 8.2 with HADR Option Folks - Working with HADR and getting this setup to work right.
1
by: Robb Gilmore | last post by:
Hi, Can anyone tell me how to get a list of which COM ports are available on the machine? I want to let the user choose from a dropdown list of COM1, COM2, etc which port he has attached a...
2
by: Diogo Alves - Software Developer | last post by:
Does Anyone knows how to get the available Serial Ports on a machine using C#?
3
by: Don | last post by:
I am writing a program and need to identify the friendly names of ports. I have queried the registry key HKEY_LOCAL_MACHIN\\EHARDWARE\\DEVICEMAP\\SERIALCOMM, but all that tells me is which ones...
3
by: tshad | last post by:
I have been trying to run IIS and Apache Tomcat on the same Server using the same Port (80 for http and 443 for https). I am trying to do this by using multiple IP address on the same Nic card. ...
2
by: joaquimfpinto | last post by:
Dear All, I made an app in c# that uses several serial ports. For the serial ports I use a pnp Sunix board, some with 8 serial ports other with 4 or even 2 serial ports. Whenever I use the...
1
by: DR | last post by:
What ports do i need to unblock on client and server (running msvsmon.exe) to debug remotely from my client box with visual studio 2005 pro? When I attach to remote process a connection shows up...
1
by: =?Utf-8?B?Qk1pbGxpa2Fu?= | last post by:
How do I find which serial COM ports are available on a particular computer? Basically, I'd likely something very similar to what HyperTerminal does where it populates and dropdown combobox with...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.