This function returns the upper bound for any dimension of a safe array.
At a Glance
Header file: | Oleauto.h |
Windows CE versions: | 2.0 and later |
Syntax
HRESULT SafeArrayGetUBound(SAFEARRAY FAR* psa,
unsigned int nDim, long FAR* plUbound);
Parameters
psa
Pointer to an array descriptor created by SafeArrayCreate.
nDim
Specifies the array dimension for which to get the upper bound.
plUbound
Pointer to the location to return the upper bound.
Return Values
One of the values obtained from the returned HRESULT and described in the following table is returned.
Value | Description |
S_OK | Success. |
DISP_E_BADINDEX | The specified index is out of bounds. |
E_INVALIDARG | One of the arguments is invalid. |
Remarks
Passing into this function any invalid and, under some circumstances, NULL pointers will result in unexpected termination of the application.
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;
}