複製鏈接
請複製以下鏈接發送給好友

LocalLock

鎖定
LocalLock是鎖定一個本地內存項目 並且 返回一個指向內存塊第一個Byte的指針
中文名
LocalLock
屬    性
鎖定一個本地內存項目
格    式
LPVOID WINAPI LocalLock
參    數
LocalAlloc返回,要麼被

目錄

LocalLock簡介

.
NoteThe local functions have greater overhead and provide fewer features than other memory management functions. New applications should use the heap functionsunless documentation states that a local function should be used. For more information, see Global and Local Functions.

LocalLock格式

LPVOID WINAPI LocalLock( __in HLOCAL hMem );

LocalLock參數

hMem[in] 本地內存的句柄 這個句柄要麼被 LocalAlloc返回,要麼被 LocalReAlloc返回.

LocalLock説明

如果函數執行成功, 返回值將是一個指向內存塊第一個Byte的指針
如果函數失敗,返回值將是NULL. To get extended error information, call GetLastError.

LocalLockRemarks

The internal data structures for each memory object include a lock count that is initially zero. For movable memory objects, LocalLockincrements the count by one, and the LocalUnlockfunction decrements the count by one. Each successful call that a process makes toLocalLockfor an object must be matched by a corresponding call to LocalUnlock. Locked memory will not be moved or discarded unless the memory object is reallocated by using the LocalReAllocfunction. The memory block of a locked memory object remains locked in memory until its lock count is decremented to zero, at which time it can be moved or discarded.
Memory objects allocated with LMEM_FIXEDalways have a lock count of zero. For these objects, the value of the returned pointer is equal to the value of the specified handle.
If the specified memory block has been discarded or if the memory block has a zero-byte size, this function returns NULL.
Discarded objects always have a lock count of zero.