Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load Dim pConnList As AutConnListTypeLibrary.AutConnList pConnList = New AutConnListTypeLibrary.AutConnList pConnList.Refresh() Debug.Print("Number of sessions: " & pConnList.Count) 'Result: 'Number of sessions: 2 End Sub
Private Sub bw_DoWork(sender As Object, e As DoWorkEventArgs) Handles bw.DoWork Dim pConnList As AutConnListTypeLibrary.AutConnList Try pConnList = New AutConnListTypeLibrary.AutConnList pConnList.Refresh() Debug.Print("Number of sessions: " & pConnList.Count) Catch ex As Exception Debug.Print(ex.Message.ToString) 'Result: 'Exception thrown: 'System.InvalidCastException' in Pcomm test.exe 'Unable to cast COM object of type 'System.__ComObject' to interface type 'AutConnListTypeLibrary.AutConnList'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{3CB39CC1-6F18-11D0-910D-0004AC3617E1}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). End Try End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)