USBClassLibrary

CPOL
C# 查看源码»
Windows
2013-11-21
红薯

USBClassLibrary 是一个用来检测 USB 设备的 C# 类库。

USBClassLibrary

示例代码:

private void USBPort_USBDeviceAttached(object sender, 
             USBClass.USBDeviceEventArgs e)
{
   if (!MyUSBDeviceConnected)
   {
      if (USBClass.GetUSBDevice(MyDeviceVID, MyDevicePID, 
                                ref USBDeviceProperties, false))
      {
         //My Device is connected
         MyUSBDeviceConnected = true;
      }
   }
}

private void USBPort_USBDeviceRemoved(object sender, 
             USBClass.USBDeviceEventArgs e)
{
   if (!USBClass.GetUSBDevice(MyDeviceVID, MyDevicePID, 
                              ref USBDeviceProperties, false))
   {
      //My Device is removed
      MyUSBDeviceConnected = false;
   }
}
加载中

评论(1)

C
Corbyn
很好用

暂无资讯

暂无问答

暂无博客

返回顶部
顶部