473,398 Members | 2,389 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,398 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 1445
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.