public class GlobalMemoryBlock extends Handle
HGLOBAL
native type.INFINITE_TIMEOUT, INVALID_HANDLE_VALUE, STATUS_ABANDONED_WAIT_0, STATUS_TIMEOUT, STATUS_WAIT_0
Constructor and Description |
---|
GlobalMemoryBlock()
Creates a global memory block.
|
GlobalMemoryBlock(Handle handle)
Creates a LocalMemoryBlock object that references the memory that handle references.
|
GlobalMemoryBlock(int size,
MemoryAllocationAttributes attributes)
Allocates the global memory block of the specified size.
|
Modifier and Type | Method and Description |
---|---|
void |
free()
Frees the allocated memory.
|
Handle |
lock()
Locks the memory block and returns the pointer to the allocated memory.
|
int |
size()
Returns the size of the allocated memory block.
|
int |
unlock()
Decrements the lock count for the memory block.
|
clone, closeHandle, equals, waitFor, waitFor
asFunction, asFunction, asTypedPointer, castTo, castTo, getDebugInfo, getLength, getValue, hashCode, isNull, read, setValue, toString, write
public GlobalMemoryBlock()
public GlobalMemoryBlock(Handle handle)
handle
- a handle to the local memory blockpublic GlobalMemoryBlock(int size, MemoryAllocationAttributes attributes)
size
- the size of the allocated memoryattributes
- allocation attributespublic void free()
public int size()
public Handle lock()
public int unlock()
GetLastError
function returns NO_ERROR
, the memory block is unlocked.