Re: Problem with SAFEARRAY as property accessors.

From: Igor Tandetnik (itandetnik_at_mvps.org)
Date: 03/25/05


Date: Fri, 25 Mar 2005 10:11:17 -0500


"Ahmad Jalil Qarshi" <ahmaddearNO@SPAMhotmail.com> wrote in message
news:ursMToTMFHA.508@TK2MSFTNGP12.phx.gbl
> error C2259: 'CComObject<class CTestLoadObj>' : cannot instantiate
> abstract class due to following members:
> c:\program files\microsoft visual
> studio\vc98\atl\include\atlcom.h(1823) : while compiling
> class-template member function 'long __stdcall ATL::CComCreator<class
> ATL::CComObject<class CTestLoadObj> >::CreateInstance(void *,const
> struct _GUID &,void ** )'
>
> could you plz tell me how to define these properties in .cpp file
> also.
> i suppose that it would be like that:
> STDMETHODIMP CTestLoadObj::get_Data(SAFEARRAY *pVal)
> {
> }
> STDMETHODIMP CTestLoadObj::put_Data(SAFEARRAY pVal)
> {
> }

A SAFEARRAY(Whatever) parameter in IDL becomes SAFEARRAY* in C++.
SAFEARRAY(Whatever)* becomes SAFEARRAY**, and so on. In other words, in
C++ you always specify one extra level of indirection compared to IDL
syntax.

-- 
With best wishes,
    Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925 


Relevant Pages

  • Re: Problem with SAFEARRAY as property accessors.
    ... > could you plz tell me how to define these properties in .cpp file ... A SAFEARRAY(Whatever) parameter in IDL becomes SAFEARRAY* in C++. ... C++ you always specify one extra level of indirection compared to IDL ...
    (microsoft.public.vc.atl)
  • Re: Byte Array aus C++ DLL in VB importieren
    ... deklarierter Parameter in COM legal ist, ... So, wie es eben dort steht, ist der nackte Pointer ein Pointer auf ein einziges Element. ... Oder in IDL gesprochen: SAFEARRAY* ... Für den Trick mit dem (SAFEARRAY (byte) * ppsa) in der IDL ...
    (microsoft.public.de.vb)
  • Re: How to Pass a SafeArray of UDTs as VARIANT
    ... Check if your UDT is output in the generated type library. ... you need to write a little IDL ... >I want to pass a safearray of UDT's as VARIANT so the safearray can be an ... > optional parameter when passed from VB. ...
    (microsoft.public.vc.atl)
  • Re: Marshalling a SAFEARRAY from an ATL component into CS.
    ... You should indicate the type of SAFEARRAY element, so your IDL should look ... >> Please post your method declaration. ... >>> returns a SAFEARRAY of INTs, but my C# component chokes on it. ...
    (microsoft.public.dotnet.languages.csharp)

Loading