A
Axel Strube-Zettler
I'm stuck now for a whole afternoon with a little Interop problem:
static object m_ovl = m_app.GetInterfaceObject("VL.Application.nn");
(m_app.GetInterfaceObject() returns the in-process VL Application)
m_ovl is a System.__ComObject, and I can't find a way to cast or cenvert
it to
the correct datatype.
In the ObjectBrowser I can find these two types:
public abstract interface VlApplication : VLLib.DVlApplication,
VLLib._DVlApplicationEvents_Event
public class VlApplicationClass : System Object
When I have a look at VL.tlb with OLE/COM Object Viewer, there are only
Dispinterfaces and CoClasses.
I have read a lot of ng postings and documention today, but nothing works:
if((m_ovl as VlApplication) != null){
...
}else if((m_ovl as VlApplicationClass) != null){
...
}else if((m_ovl as DVlApplication) != null){
...
}else{
That's where I always end up!
}
I've tried this too:
VlApplication m_vl = (VlApplication)Marshal.CreateWrapperOfType(m_ovl,
typeof(VlApplication));
=> Exception: the source object cannot be converted to target type
because it does not support all necessary interfaces
(I hope this translation of the error message is correct)
Since all that stuff is very new to me, I have no more idea how to continue.
Thanks for any ideas!
Axel
static object m_ovl = m_app.GetInterfaceObject("VL.Application.nn");
(m_app.GetInterfaceObject() returns the in-process VL Application)
m_ovl is a System.__ComObject, and I can't find a way to cast or cenvert
it to
the correct datatype.
In the ObjectBrowser I can find these two types:
public abstract interface VlApplication : VLLib.DVlApplication,
VLLib._DVlApplicationEvents_Event
public class VlApplicationClass : System Object
When I have a look at VL.tlb with OLE/COM Object Viewer, there are only
Dispinterfaces and CoClasses.
I have read a lot of ng postings and documention today, but nothing works:
if((m_ovl as VlApplication) != null){
...
}else if((m_ovl as VlApplicationClass) != null){
...
}else if((m_ovl as DVlApplication) != null){
...
}else{
That's where I always end up!
}
I've tried this too:
VlApplication m_vl = (VlApplication)Marshal.CreateWrapperOfType(m_ovl,
typeof(VlApplication));
=> Exception: the source object cannot be converted to target type
because it does not support all necessary interfaces
(I hope this translation of the error message is correct)
Since all that stuff is very new to me, I have no more idea how to continue.
Thanks for any ideas!
Axel