There's no way to do that with 100% reliability on 100% of devices. Of
course, you can enumerate through the registry branch at HKLM/Drivers/Active
and see which ones named COMx: there are.
Some of our devices are capable of being extended beyond 9 COM ports and I
chose SER as the prefix for the next 10 and ASY for the 10 after that, but
those were just strings that I came up with.
Here's an older thread where there is some code I wrote, not managed code,
of course, to count up COM ports. There's also a suggestion there from
Steve Maillet about checking with RAS for serial ports, so maybe that will
help you.
http://groups.google.com/group/microsoft.public.windowsce.app.development/browse
_thread/thread/f433e66bd91dfeef/36e85220f7a2cfc4?hl=en&lnk=st&q=#36e85220f7a2cfc
4
Paul T.
> Hi,
>
[quoted text clipped - 8 lines]
> by
> Rainer