Hi all,

I need to find out COM ports available on the PC on which my application
will be deployed.

I am using the following code
===START OF CODE===
RegistryKey myKey =
Registry.LocalMachine.OpenSubKey(@"HARDWARE\DEVICEMAP\SERIALCOMM");
if (myKey != null)
            {
                string[] str = myKey.GetValueNames();
                for(int i = 0 ; i < str.Length; i++)
                {
                    if(myKey.GetValue(str[i]).ToString().StartsWith("COM"))
                    {
                        // My logic here
                    }
                }
            }
===END OF CODE===

But I feel that not all application users will have rights to read the
registry.

Is there any other mechanism to determine the number of COM ports available
on a PC?

Regards,
Vipul Patel

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to