LocalLock

  LPVOID LocalLock(hloc)    
  HLOCAL hloc; /* handle of local memory object */

The LocalLock function retrieves a pointer to the specified local memory object. LocalLock increments (increases by one) the lock count of movable objects and locks the memory.

Parameters

hloc

Identifies the local memory object to be locked.

Return Value

The return value points to the first byte of memory in the local object, if the function is successful. Otherwise, the return value is NULL. Use the GetLastError function to obtain extended error information.

Comments

Each time an application calls LocalLock for an object, it must eventually call LocalUnlock for the object.

This function will return NULL if an application attempts to lock a memory object with a zero-byte size.

Locked memory will not be moved or discarded unless the memory object is reallocated by the LocalReAlloc function. The object remains locked in memory until its lock count is decreased to zero.

Discarded objects always have a lock count of zero.

See Also

LocalFlags, LocalReAlloc, LocalUnlock