Having posted in microsoft.publi c.dotnet.framew ork.sdk and
microsoft.publi c.dotnet.framew ork.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.Manageme nt;
public class Foo {
public static void Main() {
foreach ( ManagementObjec t port
in new ManagementClass ("Win32_SerialP ort").GetInstan ces() )
Console.WriteLi ne("{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->DeviceManage r->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.Manageme nt, .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 <=-