c#检测usb设备拨插类库USBClassLibrary分享
时间:2021-01-11 11:00:17|栏目:.NET代码|点击: 次
复制代码 代码如下:
private void USBPort_USBDeviceAttached(objectsender,
USBClass.USBDeviceEventArgs e)
{
if (!MyUSBDeviceConnected)
{
if(USBClass.GetUSBDevice(MyDeviceVID, MyDevicePID,
ref USBDeviceProperties, false))
{
//My Device is connected
MyUSBDeviceConnected = true;
}
}
}
private void USBPort_USBDeviceRemoved(objectsender,
USBClass.USBDeviceEventArgs e)
{
if(!USBClass.GetUSBDevice(MyDeviceVID, MyDevicePID,
ref USBDeviceProperties, false))
{
//My Device is removed
MyUSBDeviceConnected = false;
}
}
上一篇:在ASP.NET 2.0中操作数据之六十五:在TableAdapters中创建新的存储过程
栏 目:.NET代码
本文标题:c#检测usb设备拨插类库USBClassLibrary分享
本文地址:http://www.codeinn.net/misctech/43490.html