Delphi 获取计算机串口列表


本文整理自网络,侵删。

 
 
procedure GetSysSerialComm(CommLst: TStrings);
var
  reg: TRegistry;
  ComList: TStringList;
  i: Integer;
begin
  ComList:= TStringList.Create;
  reg:= TRegistry.Create;
  CommLst.Clear;
  try
    reg.RootKey:= HKEY_LOCAL_MACHINE;
    if reg.OpenKey('HARDWARE\DEVICEMAP\SERIALCOMM', false) then
    begin
      reg.GetValueNames(ComList);
      for i:= 0 to ComList.Count -1 do
        CommLst.Add(reg.ReadString(ComList[i]));
    end;
  finally
    ComList.Free;
    reg.Free;
  end;
end;
 
//调用示例
procedure TForm1.btn1Click(Sender: TObject);
begin
  GetSysSerialComm(cbb1.Items);
end;

来源:https://blog.csdn.net/liang08114/article/details/86712626

相关阅读 >>

processid, process handle, window handle 之间的互相转换

Delphi 实现程序 动态 类名

Delphi 公历转农历函数

Delphi idhttp代理设置

什么是Delphi firemonkey

Delphi 复制文件到剪贴板

Delphi 执行dos命令并捕获输出

Delphi xe5 程序中标识win max android ios程序代码分别实现

Delphi 简单的英文数字字符串加密解密函数(不支持中文)

Delphi 最全_日期格式_dateutils时间单元说明

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...