c#檢測usb裝備撥插類庫USBClassLibrary分享。本站提示廣大學習愛好者:(c#檢測usb裝備撥插類庫USBClassLibrary分享)文章只能為提供參考,不一定能成為您想要的結果。以下是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;
}
}