术语 | globallock |
释义 | GlobalLock 语法: C++ LPVOID WINAPI GlobalLock( __in HGLOBAL hMem ); GlobalLock函数 锁定一个全局内存对象,并返回一个指向对象的内存块的第一个字节。 注意:全局函数有更大的开销,并提供比其它内存管理功能较少的功能。新的应用程序应该使用堆,除非文档指出全局函数应该使用功能。有关更多信息,请参阅全局和局部的功能。 参数 hMem [in] 句柄全球内存对象。这是处理无论是GlobalAlloc或GlobalReAlloc函数返回。 返回值 如果函数成功,返回值是对内存块的第一个字节的指针。 如果函数失败,返回值为NULL。为了获得更多错误信息,调用GetLastError。 备注 每个内存对象内部数据结构包括一个锁计数最初为零。可移动内存对象,GlobalLock递增计数之一,GlobalUnlock函数递减计数一。每一个成功的呼叫,一个过程使以GlobalLock一个必须由相应的调用GlobalUnlock匹配的对象。锁定的内存将无法移动或丢弃,除非内存对象是使用GlobalReAlloc职能重新分配。在锁定内存对象的内存块保持锁定状态,直到其锁计数递减为零,到时可以移动或丢弃。 分配了内存中的对象GMEM_FIXED始终为零锁计数。对于这些对象时,返回指针值等于指定的句柄值。 如果指定的内存块已被取消或者如果内存块有一个零字节大小,这个函数返回NULL。 抛弃的物体始终为零锁计数。 要求: 最低支持:client-Windows 2000专业版 最低支持server-Windows 2000服务器 HeaderWinbase.h(头文件:winuser.h) LibraryKernel32.lib DLLKernel32.dll 参见 全局和局部功能 GlobalAlloc GlobalReAlloc GlobalUnlock 内存管理功能 如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com) 生成日期:2009年8月27日 ==英文原文==GlobalLock Function Locks a global memory object and returns a pointer to the first byte of the object's memory block. Note The global functions have greater overhead and provide fewer features than other memory management functions. New applications should use the heap functions unless documentation states that a global function should be used. For more information, see Global and Local Functions . Syntax C++ LPVOID WINAPI GlobalLock( __in HGLOBAL hMem ); Parameters hMem [in] A handle to the global memory object. This handle is returned by either the GlobalAlloc or GlobalReAlloc function. Return Value If the function succeeds, the return value is a pointer to the first byte of the memory block. If the function fails, the return value is 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, GlobalLock increments the count by one, and the GlobalUnlock function decrements the count by one. Each successful call that a process makes to GlobalLock for an object must be matched by a corresponding call to GlobalUnlock. Locked memory will not be moved or discarded, unless the memory object is reallocated by using the GlobalReAlloc function. The memory block of a locked memory object remains locked until its lock count is decremented to zero, at which time it can be moved or discarded. Memory objects allocated with GMEM_FIXED always 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. Requirements Minimum supported clientWindows 2000 Professional Minimum supported serverWindows 2000 Server HeaderWinbase.h (include Windows.h) LibraryKernel32.lib DLLKernel32.dll See Also Global and Local Functions GlobalAlloc GlobalReAlloc GlobalUnlock Memory Management Functions Send comments about this topic to Microsoft Build date: 8/27/2009 ==原始网址==http://msdn.microsoft.com/en-us/library/aa366584(VS.85).aspx\n |
随便看 |
|
windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。