LocalLock是鎖定一個本地記憶體項目 並且 返回一個指向記憶體塊第一個Byte的指針
基本介紹
- 中文名:LocalLock
- 屬性:鎖定一個本地記憶體項目
- 格式:LPVOID WINAPI LocalLock
- 參數: LocalAlloc返回,要么被
簡介,格式,參數,說明,Remarks,
簡介
.
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.
格式
LPVOID WINAPI LocalLock( __in HLOCAL hMem );
參數
hMem[in] 本地記憶體的句柄 這個句柄要么被 LocalAlloc返回,要么被 LocalReAlloc返回.
說明
如果函式執行成功, 返回值將是一個指向記憶體塊第一個Byte的指針
如果函式失敗,返回值將是NULL. To get extended error information, call GetLastError.
Remarks
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.