I have following vb code to connect scanner via WIA in a Windows form application.
Private Function Connect() As Device
Dim WiaDev As Device = Nothing
Dim manager As New DeviceManager()
Try
For Each info As DeviceInfo In manager.DeviceInfos
If info.DeviceID = DeviceID Then
WiaDev = info.Connect()
Return WiaDev
End If
Next
Throw New Exception(ex.Message)
End Try
End Function
It works fine in local. But in virtual machine it throws following exception while executing the line info.Connect(). Exception => "Error HRESULT E_FAIL has been returned from a call to a COM component". It will be nice if anybody suggest some solution. Thanks :)