Export (0) Print
Expand All

SafeArrayDestroy function

Destroys an existing array descriptor and all of the data in the array. If objects are stored in the array, Release is called on each object in the array.

Syntax


HRESULT SafeArrayDestroy(
  _In_  SAFEARRAY *psa
);

Parameters

psa [in]

An array descriptor created by SafeArrayCreate.

Return value

This function can return one of these values.

Return codeDescription
S_OK

Success.

E_INVALIDARG

The argument psa is not valid.

DISP_E_ARRAYISLOCKED

The array is locked.

 

Remarks

Safe arrays of variant will have the VariantClear function called on each member and safe arrays of BSTR will have the SysFreeString function called on each element. IRecordInfo::RecordClear will be called to release object references and other values of a record without deallocating the record.

Examples


STDMETHODIMP_(ULONG) CEnumPoint::Release()
{
   if(--m_refs == 0){
      if(m_psa != NULL)
      SafeArrayDestroy(m_psa);
      delete this;
      return 0;
   }
   return m_refs;
}

Requirements

Header

OleAuto.h

Library

OleAut32.lib

DLL

OleAut32.dll

 

 

Community Additions

ADD
Show:
© 2014 Microsoft