SafeArrayGetVartype Function

Returns the VARTYPE stored in the given safe array.

HRESULT SafeArrayGetVartype(
  SAFEARRAY *psa, 
  VARTYPE *pvt  
);

psa

Points to an array descriptor created by SafeArrayCreate.

pvt

Points to the storage of the VARTYPE.

The return value obtained from the returned HRESULT is one of the following.

Return value

Meaning

S_OK

Success.

E_INVALIDARG

One of the arguments is invalid.

If FADF_HAVEVARTYPE is set, SafeArrayGetVartype returns the VARTYPE stored in the array descriptor. If FADF_RECORD is set, it returns VT_RECORD; if FADF_DISPATCH is set, it returns VT_DISPATCH; and if FADF_UNKNOWN is set, it returns VT_UNKNOWN. For more information about fFeatures flags, see SAFEARRAY Data Type.

SafeArrayGetVartype can sometimes fail to return VT_UNKNOWN for SAFEARRAY types that are based on IUnknown. Callers should additionally check whether the SAFEARRAY type's fFeatures field has the FADF_UNKNOWN flag set.

Show:
© 2014 Microsoft