SafeArrayLock

This function increments the lock count of an array, and places a pointer to the array data in pvData of the array descriptor.

At a Glance

Header file: Oleauto.h
Windows CE versions: 2.0 and later

Syntax

HRESULT SafeArrayLock(SAFEARRAY FAR* psa);

Parameters

psa

Pointer to an array descriptor created by SafeArrayCreate.

Return Values

One of the values obtained from the returned HRESULT and described in the following table is returned.

Value Description
S_OK Success.
E_INVALIDARG The psa parameter was not a valid safe array descriptor.
E_UNEXPECTED The array could not be locked.

Remarks

The pointer in the array descriptor is valid until SafeArrayUnlock is called. Calls to SafeArrayLock can be nested. An equal number of calls to SafeArrayUnlock are required. Passing into this function any invalid and, under some circumstances, NULL pointers will result in unexpected termination of the application.

An array cannot be deleted while it is locked.