SafeArrayGetUBound

HRESULT SafeArrayGetUBound( 
  SAFEARRAY FAR*  psa, 
  unsigned int  nDim,  
  long FAR*  plUbound  
);
 

Returns the upper bound for any dimension of a safe array.

Parameters

psa
Pointer to an array descriptor created by SafeArrayCreate.
nDim
The array dimension for which to get the upper bound.
plUbound
Pointer to the location to return the upper bound.

Return Value

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

Return value Meaning
S_OK Success.
DISP_E_BADINDEX The specified index is out of bounds.
E_INVALIDARG One of the arguments is invalid.

Example

HRESULT
CEnumPoint::Create(SAFEARRAY FAR* psa, CEnumPoint FAR* FAR* ppenum)
{
    long lBound;
    HRESULT hresult;
    CEnumPoint FAR* penum;

    // Verify that the SafeArray is the proper shape.
    hresult = SafeArrayGetUBound(psa, 1, &lBound);
    if(FAILED(hresult))
        goto LError0;

    // Code omitted here for brevity.

LError0:;
    penum->Release();

    return hresult;
}

QuickInfo

  Windows NT: Use version 3.1 and later.
  Windows: Use Windows 95 and later.
  Header: Declared in oleauto.h.
  Import Library: Link with oleaut32.lib.