Purpose: I would like to be able to list the available COM ports on the system in Delphi.
Homework:
I read this SO stream when listing the LPT ports of a system using the registry. I also found that the COM ports are listed in the registry on HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM, but found unresponsive gestures in the same stream that it might not be so reliable on different machines and in different versions of windows.
I also found articles citing the use of QueryDosDevice (), but when I tried this sample code , I found that it did not appear in the list of any COM ports at all.
Question: What is the most reliable way (through unknown versions of Windows) to list COM ports on a Windows machine?
source
share