1) In IDL file add method with argument SAFEARRAY(BSTR)* retval method. 2) Add methods in .h and .cpp file .( with argument type SAFEARRAY** ) |
Example: Suppose in Visual studio we added a ATL simple object with name ComTestObject then |
· Edit IDL file interface IComTestObject : IDispatch{ [id(1), helpstring("method GetValutArray")] HRESULT GetValutArray([out,retval] SAFEARRAY(BSTR)* pValutarr); }; |
· ComTestObject.h |
· ComTestObject.cpp STDMETHODIMP CComTestObject::GetValutArray(SAFEARRAY** pLarr) |
Consuming COM in C#. Add COM refetence and add following code. |
public string[] GetVaultArray() |
SenApi.com |
Monday, May 26, 2008
Returning string array From COM - ATL
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment