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;
posted @ 2013-10-12 14:30  热血小伙  阅读(1098)  评论(0编辑  收藏  举报