Name
GetClipboard -- get clipboard contents (V11.0)
Synopsis
int err = GetClipboard(struct hwClipboardData *data, struct hwTagList *t);
Function
This function must get the clipboard contents and store it in data. The data argument will be set to a pointer to a struct hwClipboardData which looks like this:

 
struct hwClipboardData
{
    int Type;
    APTR Data;
};

You must initialize the structure members as follows:

Type
This must be set to the type of data contained in the Data member of the structure. This must be one of the following values:

 
HWCLIPBOARDTYPE_NONE
HWCLIPBOARDTYPE_TEXT
HWCLIPBOARDTYPE_IMAGE
HWCLIPBOARDTYPE_UNKNOWN

See below how the actual data is passed for each of those types.

Data
This must be set to a pointer to the actual data from the clipboard. The interpretation of Data depends on the data type that is set in the Type structure member. The following data types are currently supported:

HWCLIPBOARDTYPE_NONE
Set Data to NULL.

HWCLIPBOARDTYPE_TEXT
The Data member must be set to a NULL-terminated string that has been allocated using hw_TrackedAlloc(). Hollywood will free the string when it is done with it.

HWCLIPBOARDTYPE_IMAGE
The Data member must be set to a pointer to a struct hwClipboardImage which looks like this:

 
struct hwClipboardImage
{
    ULONG *Data;
    int Width;
    int Height;
    ULONG Flags;
};

This structure must contain the pixel data of the image from the clipboard. The structure members must be initialized as follows:

Data
This must be set to the pixel data of the image as 32-bit ARGB values. The pointer you specify here must have been allocated by hw_TrackedAlloc() and it will be freed by Hollywood.

Width
This must be set to the width of the image in pixels.

Height
This must be set to the height of the image in pixels.

Flags
Currently unused. Always set to 0.

Note that it's your responsibility to make sure that the pointer to the struct hwClipboardImage is still valid when your function returns. It's recommended to use a static local variable to make sure the memory is still accessible to Hollywood when your function returns.

HWCLIPBOARDTYPE_UNKNOWN
Set Data to NULL.

Inputs
data
data from the clipboard (see above)
tags
reserved for future use, always NULL currently
Results
err
error code or 0 for success

Show TOC