Hello
I am trying to interface with a legacy MFC out-of-proc COM server. Some by ref arguments work fine (like long*) the other (IUnknown**) give me a DISP_E_TYPEMISM ATCH, no matter what I try. Example:
COM server:
VB.NET:
Works...getting the right value, however:
COM server:
VB.NET
(I've tried all the following types, none works)
The value returned by the COM server is NULL if no error happened in the function, otherwise a DQSERROR COM object.
I spend two days reading articles on this and IntPtr should do the job, followed by Marshal.QueryIn terafce() but it does now work.
Any help would be appreciated. Tx.
I am trying to interface with a legacy MFC out-of-proc COM server. Some by ref arguments work fine (like long*) the other (IUnknown**) give me a DISP_E_TYPEMISM ATCH, no matter what I try. Example:
COM server:
Code:
long CNAVDocViewer::getMainWindowHandle(long* _plhWnd)
Code:
Dim o As Object = CreateObject("NAVDocViewer.NAVDocViewer")
Dim h As Integer = Integer.MinValue
o.getMainWindowHandle(h)
COM server:
Code:
long CNAVDocViewer::closeAllDocument(IUnknown** _ppitfEreur)
(I've tried all the following types, none works)
Code:
' DISP_E_TYPEMISMATCH
Dim err As Object = Nothing ' No
Dim errDQS As aDQSErrorServr.DQSEror = New aDQSErrorServr.DQSEror ' No
Dim errDQSI As aDQSErrorServr.IDQSEror = Nothing ' No
Dim i As Int32 = 0 ' No
Dim s As String = "" ' No... :)
Dim p As IntPtr = Nothing ' No
Dim p1 As IntPtr = New IntPtr(0) ' No
Dim p2 As IntPtr = Marshal.GetIUnknownForObject(errDQS) ' No
o.closeAllDocument(errDQSI)
I spend two days reading articles on this and IntPtr should do the job, followed by Marshal.QueryIn terafce() but it does now work.
Any help would be appreciated. Tx.
Comment