Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 有没有办法使用Windows10API查找所有COM端口设备_C#_Windows 10_Com Port - Fatal编程技术网

C# 有没有办法使用Windows10API查找所有COM端口设备

C# 有没有办法使用Windows10API查找所有COM端口设备,c#,windows-10,com-port,C#,Windows 10,Com Port,如果我们知道COM端口号,可以在COMP端口上获取设备的详细信息 var query=SerialDevice.GetDeviceSelector(“COM3”); var deviceInformationCollection=wait DeviceInformation.findalsync(查询); 但是,我想知道是否有可能获得所有COM端口的详细信息。我试着跟随,但不起作用 var query=SerialDevice.GetDeviceSelector(“COM*”); var de

如果我们知道COM端口号,可以在COMP端口上获取设备的详细信息

var query=SerialDevice.GetDeviceSelector(“COM3”);
var deviceInformationCollection=wait DeviceInformation.findalsync(查询);
但是,我想知道是否有可能获得所有COM端口的详细信息。我试着跟随,但不起作用

var query=SerialDevice.GetDeviceSelector(“COM*”);
var deviceInformationCollection=wait DeviceInformation.findalsync(查询);

“高级查询选择器”-我尝试了这个方法,但没有成功<代码>查询=@“System.Devices.InterfaceClassGuid:=”{86E0D1E0-8089-11D0-9CE4-08003E301F73}”和System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#True和System.DeviceInterface.Serial.PortName:~~“COM”仅使用InterfaceClassGuid(或类似地,其他属性)时会发生什么?没有,当我调用
GetDeviceSelector
I get
System.Devices.InterfaceClassGuid:=“{86E0D1E0-8089-11D0-9CE4-08003E301F73}”和System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#True和System.DeviceInterface.Serial.PortName:=“COM13”或(System.Devices.InterfaceClassGuid:=“{86E0D1E0-8089-11D0-9CE4-08003E301F73}”和System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#True和(System.Devices.DeviceInstanceId:=FTDIBUS\VID_0403+PID_6001+FTY435VMA\0000))
。如果我尝试使用表达式的第一部分(在或之前),它也不起作用。“高级查询选择器”-,我尝试过,但不起作用。
Query=@“System.Devices.InterfaceClassGuid:=”{86E0D1E0-8089-11D0-9CE4-08003E301F73}”“和System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#True和System.DeviceInterface.Serial.PortName:~”“COM”“;
当仅使用InterfaceClassGuid(或类似的其他属性)时会发生什么?没有,当我调用
GetDeviceSelector
我得到
System.Devices.InterfaceClassGuid:=”{86E0D1E0-8089-11D0-9CE4-08003E301F73}和系统.设备.接口启用:=系统.结构查询类型.布尔值#True和系统.设备接口.串行.端口名:=“COM13”或(系统.设备.接口类GUID:=“{86E0D1E0-8089-11D0-9CE4-08003E301F73}”和系统.设备.接口启用:=系统.结构查询类型.布尔值#True和(System.Devices.DeviceInstanceId:=FTDIBUS\VID_0403+PID_6001+FTY435VMA\0000))
。如果尝试使用表达式的第一部分(在或之前),它也不起作用。