Answer the question
In order to leave comments, you need to log in
How to get a list of COM ports in Windows correctly?
It became curious how to get the list of serial ports in Windows correctly .
From the Internet, we managed to find out that there are a handful of ways and one is worse than the other. Let me explain that only a list of ports is needed, without any descriptions.
upd: I tend to read ports from the registry because they write this on msdn.microsoft:
Use the GetPortNames method to query for a list of valid serial port names on the current computer. For example, this method allows you to determine if COM1 and COM2 are valid serial ports for the current computer.
The port names are loaded from the system registry (for example, HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM). If the data in the registry is inaccurate or out of date, the GetPortNames method will return incorrect results.
Answer the question
In order to leave comments, you need to log in
The most reliable way, which not only finds ports, but also determines their employment, is a direct enumeration of all 255 name options.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question