471,062 Members | 1,849 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Finding/Listing usb/bluetooth/... serial-ports with System.Management.dll[reposted from microsoft.public.dotnet.framework.sdk, microsoft.public.dotnet.framework.wmi]


Having posted in microsoft.public.dotnet.framework.sdk and
microsoft.public.dotnet.framework.wmi without receiving any response, I
posthere on the off-chance that someone who isn't following those groups
knows a solution.

I'm using code (roughly like):

using System;
using System.Management;
public class Foo {
public static void Main() {
foreach ( ManagementObject port
in new ManagementClass("Win32_SerialPort").GetInstances() )
Console.WriteLine("{0}: {1}", port["deviceid"], port["name"]);
}
}

To query for the serial ports present on a system.

Unfortunatly, this doesn't seem to include COM-ports available via
usb-adapters or bluetooth. These devices are visible in the
DeviceManager in System->Hardware->DeviceManager->Ports (COM & LPT), and
I want to get the same list as that, just without the LPT ports.

What am I doing wrong?

I had trouble finding info on the web, so here's something for the
search engines to catch on for the benefit of the next guy.

Keywords: com, com-port, serial-port, WMI, System.Management, .NET, C#,
enumerating, listing, finding, searching, win32, windows, win32api)

--
Helge Jensen
mailto:he**********@slog.dk
sip:he**********@slog.dk
-=> Sebastian cover-music: http://ungdomshus.nu <=-
Jul 22 '05 #1
0 2150

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Jean-Sébastien Guay | last post: by
3 posts views Thread by Yavuz Bogazci | last post: by
1 post views Thread by henrycortezwu | last post: by
reply views Thread by AbdullahWMGhaleb | last post: by
4 posts views Thread by Logan | last post: by
reply views Thread by leo001 | last post: by

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.