Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

The problem to pass the COM object as a parameter

yan4362yan4362 Member Posts: 1
Bascially, I have two COM objects in two ATL DLL projects.
One is controller and one is data. One method in Controller
uses data as one parameter. When I compile, I got

error MIDL2337: unsatisfiled forward declaration: IWLdataEx [Parameter
'pData' of Procedure 'getData' [interface 'IWLiaController')]

Here is whole stuff:

I found if I do not put any method in IWLdataEx, it can be compiled. But after I insert two methods

[propget, id(1), helpstring("property controlData")] HRESULT
controlData([out, retval] BSTR* pVal);
[propput, id(1), helpstring("property controlData")] HRESULT
controlData([in] BSTR newVal);

into IWLdataEx, I got

error MIDL2337: unsatisfiled forward declaration: IWLdataEx [Parameter
'pData' of Procedure 'getData' [interface 'IWLiaController')]

If I put
iaData::IWLdataEx** pData
as the parameter, it causes the same error.

Any idea?

Thanks a lot!

//===================================== WLcontroller===================
// WLiaController.h : Declaration of the CWLiaController
#pragma once
#include "resource.h" // main symbols
[ importlib(..iaDataDebugiaData.dll) ];
[
object,
library_block,
uuid("55521BDE-B8C5-4E51-B12A-54B7A090AD02"),
dual, helpstring("IWLiaController Interface"),
pointer_default(unique)
]
__interface IWLiaController : IDispatch
{
[id(1), helpstring("method getData")] HRESULT getData([out, retval]
IWLdataEx** pData);
};
// CWLiaController
[
coclass,
threading("free"),
vi_progid("iaController.WLiaController"),
progid("iaController.WLiaController.1"),
version(1.0),
uuid("0B1AB121-BD96-4299-A8D4-D659D1FA4C48"),
helpstring("WLiaController Class")
]
class ATL_NO_VTABLE CWLiaController :
public IWLiaController
{
public:
CWLiaController()
{
}

DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
STDMETHOD(getData)(IWLdataEx** pData);
};

//============================== IWLdataEx===================
// WLdataEx.h : Declaration of the CWLdataEx
#pragma once
#include "resource.h" // main symbols

// IWLdataEx
[
object,
uuid("5CF13B79-4716-4A4A-9CF4-B4DAA680101A"),
dual, helpstring("IWLdataEx Interface"),
pointer_default(unique)
]
__interface IWLdataEx : IDispatch
{
[propget, id(1), helpstring("property controlData")] HRESULT
controlData([out, retval] BSTR* pVal);
[propput, id(1), helpstring("property controlData")] HRESULT
controlData([in] BSTR newVal);
};


// CWLdataEx
[
coclass,
threading("free"),
vi_progid("iaData.WLdataEx"),
progid("iaData.WLdataEx.1"),
version(1.0),
uuid("D150443C-5508-4D79-8E30-91C4339A7C03"),
helpstring("WLdataEx Class")
]
class ATL_NO_VTABLE CWLdataEx :
public IWLdataEx
{
public:
CWLdataEx()
{
}

DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
STDMETHOD(get_controlData)(BSTR* pVal);
STDMETHOD(put_controlData)(BSTR newVal);
};

Sign In or Register to comment.