function GetComPortList: TStrings;
var
Reg: TRegistry;
sts1,sts2: TStrings;
i: Integer;
RegPath: string; //×¢²á±íÖдæ·Å´®¿Ú·¾¶
begin
Result := nil;
Reg := TRegistry.Create;
try
sts1 := TStringList.Create;
try
sts2 := TStringList.Create;
Reg.RootKey := HKEY_LOCAL_MACHINE;
RegPath := 'hardware/devicemap/SerialComm';
if Reg.OpenKey(RegPath, False) then
begin
Reg.GetValueNames(sts1);
for i := 0 to sts1.Count-1 do
sts2.Add(Reg.ReadString(sts1.Strings[i]));
end;
Result := sts2;
sts2 := nil;
finally
FreeAndNil(sts1);
end;
finally
Reg.CloseKey;
FreeAndNil(Reg);
end;
end;