Hi All,
I am writing a utility which writes data to a device connected to a Virtual COM Port connected by USB. The trouble is, Windows has a nasty habit of re-assigning COM port numbers to different devices, or even sometimes the same device connected to a different USB port. So while I can use Device Manager to establish which COM port I am connected to, and hand edit my code to use that port, that won't help eventual users who will run the executable using a device plugged into which ever USB port they choose. So at runtime, m y code will have no idea which COM port to open.
Does anyone have a good idea how to find the next available COM port number, or which ports are available so I can give the user the option?