Function Reference


_MemGlobalReAlloc

ReAllocates the specified number of bytes from the heap

#include <Memory.au3>
_MemGlobalReAlloc ( $hMemory, $iBytes [, $iFlags = 0] )

Parameters

$hMemory A handle to the global memory object to be reallocated. This handle is returned by either the _MemGlobalAlloc or _MemGlobalReAlloc function.
$iBytes The new size of the memory block, in bytes. If $iFlags specifies $GMEM_MODIFY, this parameter is ignored.
$iFlags [optional] The memory allocation attributes:
    $GMEM_MOVEABLE - optionally combine with $GMEM_MODIFY.
    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
    $GMEM_ZEROINIT - If this parameter does not specify $GMEM_MODIFY, initializes additional memory contents to zero if the memory object is growing in size.

Return Value

Success: a handle to the newly reallocated memory object.
Failure: 0.

Remarks

If _MemGlobalReAlloc reallocates a movable object, the return value is a handle to the memory object. To convert the handle to a pointer, use the _MemGlobalLock function.

If _MemGlobalReAlloc 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 _MemGlobalReAlloc fails, the original memory is not freed, and the original handle and pointer are still valid.

Related

_MemGlobalFree, _MemGlobalLock, _MemGlobalAlloc, _MemGlobalSize, _MemVirtualAlloc

See Also

Search GlobalReAlloc in MSDN Library.