TRegistry * reg=new TRegistry;
reg->RootKey=HKEY_LOCAL_MACHINE;
reg->OpenKey("HARDWARE//DEVICEMAP//SERIALCOMM",true);
comList->Sorted=false;
reg->GetValueNames(comList->Items);
comList->Items->BeginUpdate();
for(int i=0;i<comList->Items->Count;i++)
comList->Items->Strings[i]=reg->ReadString(comList->Items->Strings[i]);
comList->Items->EndUpdate();
comList->Sorted=true;
读计算机上的所有串口
最新推荐文章于 2023-08-01 10:17:52 发布
本文介绍了一段使用 C++ 编写的代码,该代码通过调用 Windows API 函数来枚举本地计算机上的串口列表。具体操作包括创建 TRegistry 对象、设置根键为 HKEY_LOCAL_MACHINE,并打开指定的子键路径,读取串口设备名称。
6867

被折叠的 条评论
为什么被折叠?



