LocalLock

王朝百科·作者佚名  2012-04-26  
宽屏版  字体: 小  |  中  |  大  |  超大  

锁定一个本地内存项目 并且 返回一个指向内存块第一个Byte的指针.

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, callGetLastError.RemarksThe 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 theLocalUnlockfunction decrements the count by one. Each successful call that a process makes toLocalLockfor an object must be matched by a corresponding call toLocalUnlock. Locked memory will not be moved or discarded unless the memory object is reallocated by using theLocalReAllocfunction. 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 withLMEM_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 returnsNULL.

Discarded objects always have a lock count of zero.

 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝百科 版权所有