abhinav abhinav - 2 months ago 23
C++ Question

best method to find the COM port to which my embeded device got connected in my vc++ program

I want to find the COM port my device got connected in my vc++ program.
upto now i used to scan all the ports from 0 to 15 and send some command if the reply is suitable to me i can confirm that it is the port i am finding.

But this is Taking a lot of time.

anyother solution???


The serial API does not provide for any of the sort of identification that you seem to desire so the only choice that you have is to poll he various ports. If the device is a USB device, you may be able to garnish clues from the friendly name associated with that device (see How do I get the friendly name of a COM port in Windows?).