- Main Page
- Packages
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# smjg.libs.sdwf.globalmem.GlobalMemoryObject Class Reference

The smjg.libs.sdwf.globalmem.GlobalMemoryObject class encapsulates a memory block allocated on the Windows heap. More...

List of all members.

## Public Member Functions
| this (uint bytes, GMEM flags)
| Constructs and allocates a new global memory object.
| this (string data, GMEM flags)
| Creates a global memory copy of a given text string.
| this (void[] data, GMEM flags)
| Creates a global memory copy of a given data block.
| this (HANDLE h)
| Creates a GlobalMemoryObject to interface a pre-existing global memory object.
| ~this ()
HANDLE | clipboardDataHandle (CLIPBOARD_FORMAT format, bool clearAutoDelete=true)
| Data handle to this object for placing on the clipboard.
Operators
final int | opEquals (Object o)
final int | opEquals (GlobalMemoryObject a)
Properties
HANDLE | handle ()
| The Windows handle of this global memory object.
uint | length ()
| The length in bytes of this global memory object.
GlobalMemoryObject | dup ()
| Creates a copy of the global memory object.
## Public Attributes
bool | autoDelete = true
| Whether this memory object will automatically be deallocated when the GlobalMemoryObject is garbage-collected.

## Detailed Description

The smjg.libs.sdwf.globalmem.GlobalMemoryObject class encapsulates a memory block allocated on the Windows heap.

Such a block is used e.g. for clipboard and DDE communications. (SDWF doesn't currently provide DDE facilities.)

Since:
  0.3

Status:
  done

## Constructor & Destructor Documentation

smjg.libs.sdwf.globalmem.GlobalMemoryObject.this | ( | uint | bytes,
|  | GMEM | flags |
| ) |  |  |

Constructs and allocates a new global memory object.

Parameters:

  | bytes | number of bytes to allocate.
  | flags | flags pertaining to the global memory object.

smjg.libs.sdwf.globalmem.GlobalMemoryObject.this | ( | string | data,
|  | GMEM | flags |
| ) |  |  |

Creates a global memory copy of a given text string.

This constructor differs from GlobalMemoryObject.this(void[], GMEM) in that the string is automatically null-terminated as required by Windows.

Parameters:

  | data | data with which to initialise the allocated memory.
  | flags | flags pertaining to the global memory object.

smjg.libs.sdwf.globalmem.GlobalMemoryObject.this | ( | void[] | data,
|  | GMEM | flags |
| ) |  |  |

Creates a global memory copy of a given data block.

Parameters:

  | data | data with which to initialise the allocated memory.
  | flags | flags pertaining to the global memory object.

smjg.libs.sdwf.globalmem.GlobalMemoryObject.this | ( | HANDLE | h | ) |

Creates a GlobalMemoryObject to interface a pre-existing global memory object.

The autoDelete property is set to `false`.

Parameters:

  | h | Windows handle of the memory object.

smjg.libs.sdwf.globalmem.GlobalMemoryObject.~this | ( |  | ) |

## Member Function Documentation

HANDLE smjg.libs.sdwf.globalmem.GlobalMemoryObject.clipboardDataHandle | ( | CLIPBOARD_FORMAT | format,
|  | bool | clearAutoDelete = `true` |
| ) |  |  |

Data handle to this object for placing on the clipboard.

final int smjg.libs.sdwf.globalmem.GlobalMemoryObject.opEquals | ( | Object | o | ) |

Determines whether this GlobalMemoryObject is equal to another object.

Since:
  0.4

final int smjg.libs.sdwf.globalmem.GlobalMemoryObject.opEquals | ( | GlobalMemoryObject | a | ) |

Determines whether this GlobalMemoryObject is equal to another WindowBase. Two GlobalMemoryObject objects are equal iff they have the same handle, i.e. they interface the same memory object.

Since:
  0.4

HANDLE smjg.libs.sdwf.globalmem.GlobalMemoryObject.handle | ( |  | ) |

The Windows handle of this global memory object.

You would use this property if you need to call a Windows API function directly on the memory object.

uint smjg.libs.sdwf.globalmem.GlobalMemoryObject.length | ( |  | ) |

The length in bytes of this global memory object.

GlobalMemoryObject smjg.libs.sdwf.globalmem.GlobalMemoryObject.dup | ( |  | ) |

Creates a copy of the global memory object.

This can be used to create an ad-hoc copy to put onto the clipboard, or for an application to make its own copy of data taken from the clipboard.

Returns:
  a new GlobalMemoryObject with the data copied from this object, and the GMEM.MOVEABLE and GMEM.SHARE flags set ready to put the object onto the clipboard.

Status:
  test

## Member Data Documentation

bool smjg.libs.sdwf.globalmem.GlobalMemoryObject.autoDelete = true

Whether this memory object will automatically be deallocated when the GlobalMemoryObject is garbage-collected.

This must be false in order to use the GlobalMemoryObject for purposes such as clipboard communication. The Clipboard.add method automatically sets this property of its argument to `false`.

The documentation for this class was generated from the following file:

- globalmem.d