Danil Shebounin
2/9/2007 2:26:00 PM
Hello!
I'm trying to pass an array of WORD values from COM interface method to a
managed application.
In Visual Studio 2005 wizard I have created an ATL project with COM object
and several interfaces. The interface have following description:
__interface IAttrList : IDispatch
{
....
[id(8)] HRESULT GetWordArray([in] BSTR attr, [out,retval]SAFEARRAY **ret);
}
When I compiling this file, I get MIDL errors. I tried to declare ret
parameter, as said in MSDN, like this: [out, retval]SAFEARRAY(WORD) *ret, and
get CL compiler error.
I tried many different approaches and variants, there is no place to
describe them all here.
I need, that following simple lines of code worked in my C# program:
IAttrList attrList = new CAttrList();
attrList.Fill();
UInt16[] buf = attrList.GetWordArray("Name");
Is it possible at all to pass an array of WORDs from COM to managed
application in that way?
Thanx in advance!
Dan.