I have a component (written in VC++6.0 ATL 3.0)
that has a dual interface, and a custom interface.
custom interface has a setparcel method, that takes
a structure (two methods one with value other with reference)
here is a part from idl file
typedef struct tagPocket
{
long ID; // here I removed all members but one for simplicity//
} Pocket;
interface IParcelCustom : IUnknown
{
[helpstring("method SetParcel")] HRESULT SetParcel([in] Pocket parcel);
[helpstring("method GetParcel")] HRESULT GetParcel([out, retval] Pocket *parcel);
[helpstring("method SetParcelByRef")] HRESULT SetParcelByRef([in] Pocket *pparcel);
};
and dual interface has
interface IParcel : IDispatch
{
[id(1), helpstring("method GetID")] HRESULT GetID([out, retval] long* id);
[id(2), helpstring("method GetCustomInterface")] HRESULT GetCustomInterface([out, retval] IParcelCustom** ppObj);
};
so it can return a custom interface
this works fine from a C++ client.
but from excel VBA I try to convince it that I have the same structure, my vb code is
Dim a As New Parcel
Dim b As IParcelCustom
Private Type tagPocket
samp_t As Long
End Type
Sub test()
Set b = a.GetCustomInterface
Dim pocket As tagPocket
pocket.samp_t = 30
b.SetParcelByRef (pocket) // here is the compile error
End Sub
it says Type mismatch (Error 13)
so he does not like my structure
although he expects pparcel As tagPocket on the tooltip
as below
b.SetParcelByRef (pparcel As tagPocket)
so how can I convince the compiler that it is what it should be. ??? If I can work this I will
increase the points, nd please do not lock the question
by guessing. just put a command. thanks.