System.Runtime.InteropServices.SEHException was unhandled
Message=External component has thrown an exception.
Source=mscorlib
ErrorCode=-2147467259
StackTrace:
at Microsoft.Win32.Win32Native.CloseHandle(IntPtr handle)
at Microsoft.Win32.SafeHandles.SafeFileHandle.ReleaseHandle()
at System.Runtime.InteropServices.SafeHandle.InternalFinalize()
at System.Runtime.InteropServices.SafeHandle.Dispose(Boolean disposing)
at System.Runtime.InteropServices.SafeHandle.Finalize()
InnerException:
我阅读了所有关于 SEHException 的帖子,但我无法解决我的问题,请帮忙。这是我怀疑的代码:
If hWinUSBInterface = INVALID_HANDLE_VALUE And hDevice = INVALID_HANDLE_VALUE Then
If Not tmrAutoConnect.Enabled Then
RaiseEvent Notify(2, "Not connected")
End If
Return
End If
Try
If hWinUSBInterface <> INVALID_HANDLE_VALUE Then
WinUsb_Free(hWinUSBInterface)
hWinUSBInterface = INVALID_HANDLE_VALUE
End If
If hDevice <> INVALID_HANDLE_VALUE Then
If CloseHandle(hDevice) Then
hDevice = INVALID_HANDLE_VALUE
RaiseEvent Disconnected()
Else
Dim ErrorStatus As Integer = Err.LastDllError
RaiseEvent Error(1, ErrorStatus, "Disconnect")
End If
End If
Catch ex As Exception
End Try
任何想法?谢谢