c#检测usb设备 c#检测usb设备拨插类库USBClassLibrary分享
人气:0想了解c#检测usb设备拨插类库USBClassLibrary讲解的相关内容吗,在本文为您仔细讲解c#检测usb设备的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:c#检测usb,USBClassLibrary,下面大家一起来学习吧。
复制代码 代码如下:
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;
}
}
加载全部内容