Hi,
ein paar augenfällige Korrekturen:
Delphi-Quellcode:
uses
Types;
....
function ReadComPorts : TStringDynArray;
var
reg: TRegistry;
st: Tstrings;
i: Integer;
begin
reg := TRegistry.Create;
try
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.OpenKey('hardware\devicemap\serialcomm', False);
st := TStringList.Create;
try
reg.GetValueNames(st);
setlength(result, st.Count);
for i := 0 to Pred(st.Count) do
result[i] := reg.Readstring(st[i]);
finally
st.Free;
end;
reg.CloseKey;
finally
reg.Free;
end;
end;
Grüße vom marabu