
VC++ pass object parameter to VB ActiveX DLL
Quote:
> I need to call VB ActiveX DLL method from VC++, how can
> I pass an object (user-defined type) parameter which is
> defined as a class type in VB ActiveX DLL.
> The VC++ classwizard will generate following method
> declaration in wrapper class:
> void SetDocumentation(LPDISPATCH);
> In VB ActiveX DLL, the corresponding mehod would be:
> sub SetDocumentation(obj as CMyObject);
C++ equivalent (assuming CMyObject is defined in the VB dll):
HRESULT SetDocumentation(/*[in, out]*/ _CMyObject** obj);
Although I understand MFC does things differently, which is presumably
where the classwizard comes in. If you're not using MFC, you should
use #import.
Quote:
> My question is how can I create and pass LPDISPATCH in
> VC++?
Presumably you have an instance of CMyObject to pass. Also presumably,
it's a dual interface. In that case, you can QI it for IDispatch and
pass the result.