网站首页  词典首页

请输入您要查询的函数:

 

术语 globalrealloc
释义 GlobalReAlloc
语法:
C++
HGLOBAL WINAPI GlobalReAlloc(
__in HGLOBAL hMem,
__in SIZE_T dwBytes,
__in UINT uFlags
);
GlobalReAlloc功能
变化的大小或指定的全局内存对象的属性。大小可以增加或减少。
注意:全局函数有更大的开销,并提供比其它内存管理功能较少的功能。新的应用程序应该使用堆,除非文档指出全局函数应该使用功能。有关更多信息,请参阅全局和局部的功能。
参数
hMem [in]
句柄全球内存对象被重新分配。这是处理无论是GlobalAlloc或GlobalReAlloc函数返回。
dwBytes [in]
该内存块的新的大小,以字节为单位。如果uFlags指定GMEM_MODIFY,此参数被忽略。
uFlags [in]
重新分配方案。如果GMEM_MODIFY指定的函数修改内存的唯一对象的属性(即dwBytes参数被忽略。)否则,函数重新分配的内存对象。
您可以选择结合起来,下面的值GMEM_MODIFY。
ValueMeaning
GMEM_MOVEABLE
0x0002Allocates移动内存。
如果内存是一个锁定GMEM_MOVEABLE内存块或GMEM_FIXED内存块,这个标志是没有指定,内存只能在地方重新分配。
如果此参数不指定GMEM_MODIFY,您可以使用下面的值。
ValueMeaning
GMEM_ZEROINIT
0x0040Causes额外的内存内容的初始化为零,如果内存对象是越来越大。
返回值
如果函数成功,返回值是一个句柄分配内存对象。
如果函数失败,返回值为NULL。为了获得更多错误信息,调用GetLastError。
备注
如果GlobalReAlloc重新分配一个可移动的对象,返回值是一个句柄内存对象。处理转换为指针,使用GlobalLock函数。
如果GlobalReAlloc重新分配一个固定的对象,在处理返回的值是内存块的第一个字节的地址。要访问内存,这个过程可以简单地将返回值转换为一个指针。
如果GlobalReAlloc失败,原来的内存不释放,和原处理和指针仍然有效。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
全局和局部功能
GlobalAlloc
GlobalDiscard
GlobalLock
内存管理功能
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==GlobalReAlloc Function
Changes the size or attributes of a specified global memory object. The size can increase or decrease.
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++
HGLOBAL WINAPI GlobalReAlloc(
__in HGLOBAL hMem,
__in SIZE_T dwBytes,
__in UINT uFlags
);
Parameters
hMem [in]
A handle to the global memory object to be reallocated. This handle is returned by either the GlobalAlloc or GlobalReAlloc function.
dwBytes [in]
The new size of the memory block, in bytes. If uFlags specifies GMEM_MODIFY, this parameter is ignored.
uFlags [in]
The reallocation options. If GMEM_MODIFY is specified, the function modifies the attributes of the memory object only (the dwBytes parameter is ignored.) Otherwise, the function reallocates the memory object.
You can optionally combine GMEM_MODIFY with the following value.
ValueMeaning
GMEM_MOVEABLE
0x0002Allocates movable memory.
If the memory is a locked GMEM_MOVEABLE memory block or a GMEM_FIXED memory block and this flag is not specified, the memory can only be reallocated in place.

If this parameter does not specify GMEM_MODIFY, you can use the following value.
ValueMeaning
GMEM_ZEROINIT
0x0040Causes the additional memory contents to be initialized to zero if the memory object is growing in size.

Return Value
If the function succeeds, the return value is a handle to the reallocated memory object.
If the function fails, the return value is NULL. To get extended error information, call GetLastError .
Remarks
If GlobalReAlloc reallocates a movable object, the return value is a handle to the memory object. To convert the handle to a pointer, use the GlobalLock function.
If GlobalReAlloc reallocates a fixed object, the value of the handle returned is the address of the first byte of the memory block. To access the memory, a process can simply cast the return value to a pointer.
If GlobalReAlloc fails, the original memory is not freed, and the original handle and pointer are still valid.
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
GlobalDiscard
GlobalLock
Memory Management Functions
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa366590(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:18:48