Delphi 查看所有的串口设备
var reg : TRegistry; sComm : TStrings; i : integer; begin reg := TRegistry.Create; reg.RootKey := HKEY_LOCAL_MACHINE; reg.OpenKey('hardware\devicemap\serialcomm',false); sComm := TStringList.Create; reg.GetValueNames(sComm); cbb1.Items.Clear; for i := 0 to sComm.Count -1 do begin cbb1.Items.Add(reg.ReadString(sComm.Strings[i])); end; sComm.Free; reg.CloseKey; reg.free; end;