Created
July 10, 2017 10:18
-
-
Save Brutt/fe145c97437decf552ca18e150d66b1c to your computer and use it in GitHub Desktop.
Get the list of available COM-ports from Windows Registry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uses Registry; | |
procedure getCOM_ports(); | |
var | |
reg: TRegistry; | |
st: Tstrings; | |
begin | |
reg := TRegistry.Create(KEY_READ); | |
try | |
reg.RootKey := HKEY_LOCAL_MACHINE; | |
reg.OpenKey('hardware\devicemap\serialcomm', False); | |
st := TstringList.Create; | |
try | |
reg.GetValueNames(st); | |
for i := 0 to st.Count - 1 do | |
begin | |
ShowMessage(reg.Readstring(st.strings[i])); | |
end; | |
finally | |
st.Free; | |
end; | |
reg.CloseKey; | |
finally | |
reg.Free; | |
end; | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment