查找串口-ObjectQuery("SELECT * FROM Win32_SerialPort")
2021-05-02 18:29
标签:命名 nbsp omv ros mes user library query pid using System.IO.Ports; [ComVisibleAttribute(true)] //在命名空间下添加com可见性 最基本的USB设备结构 USB串口的结构 https://msdn.microsoft.com/en-us/library/aa394504(v=vs.85).aspx 查找串口-ObjectQuery("SELECT * FROM Win32_SerialPort") 标签:命名 nbsp omv ros mes user library query pid 原文地址:http://www.cnblogs.com/zhangkun35268/p/7760524.html
using System.Management; //加了这句之后,仍然有红色波浪线提示,说明需要手动添加dll引用(vs2012) String tmpstr1 = "";
string tmpPort = "";
List
class USBDeviceInfo
{
public USBDeviceInfo(string deviceID, string pnpDeviceID, string description)
{
this.DeviceID = deviceID;
this.PnpDeviceID = pnpDeviceID;
this.Description = description;
}
public string DeviceID { get; private set; }
public string PnpDeviceID { get; private set; }
public string Description { get; private set; }
}
[Dynamic, provider("CIMWin32"), UUID("{98C7E2C7-D592-11d2-B355-00105A0A323A}"), AMENDMENT]
class Win32_USBController : CIM_USBController
{
uint16 Availability;
string Caption;
uint32 ConfigManagerErrorCode;
boolean ConfigManagerUserConfig;
string CreationClassName;
string Description;
string DeviceID;
boolean ErrorCleared;
string ErrorDescription;
datetime InstallDate;
uint32 LastErrorCode;
string Manufacturer;
uint32 MaxNumberControlled;
string Name;
string PNPDeviceID;
uint16 PowerManagementCapabilities[];
boolean PowerManagementSupported;
uint16 ProtocolSupported;
string Status;
uint16 StatusInfo;
string SystemCreationClassName;
string SystemName;
datetime TimeOfLastReset;
};
文章标题:查找串口-ObjectQuery("SELECT * FROM Win32_SerialPort")
文章链接:http://soscw.com/index.php/essay/81453.html