468,758 Members | 2,087 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,758 developers. It's quick & easy.

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 2086

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 zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.