BinaryClipPut

Writes a binary buffer to the Windows clipboard.

Syntax:

BinaryClipPut( handle, format [,perserve-data] )

Parameters:

(i) handle: handle of buffer.

(i) format: format of clipboard data.

(i) preserve-data: [optional] 1 (@True ) to preserve existing clipboard data. 0 (@False) to clean existing data (defaults to 0).

Returns:

(i) returns 1.

 

Note that this function destroys the previous contents of the clipboard unless the optional perserve-data parameter is present and set to 1 (@True).

The following is a list of possible clipboard formats. Note that some of them may not be supported, because the clipboard contains a pointer or handle to external data instead of the data itself.

 

Value

Meaning

1

CF_TEXT

2

CF_BITMAP (not supported)

3

CF_METAFILEPICT

4

CF_SYLK

5

CF_DIF

6

CF_TIFF

7

CF_OEMTEXT

8

CF_DIB

9

CF_PALETTE

10

CF_PENDATA

11

CF_RIFF

12

CF_WAVE

13

CF_UNICODETEXT

14

CF_ENHMETAFILE

15

CF_HDROP

16

CF_LOCALE

128

CF_OWNERDISPLAY

129

CF_DSPTEXT

130

CF_DSPBITMAP

131

CF_DSPMETAFILEPICT

142

CF_DSPENHMETAFILE

 

The optional preserve-data parameter prevents the function form clearing all existing clipboard content when it is set to 1 (@True).  However, the function replaces the contents of any existing data of the format indicated by the function's second parameter so data of that format is not preserved even when the preserve-data parameter is set to 1.  Note that some format types are automatically synthesized by the system clipboard.  For example, if you place CF_TEXT on the clipboard the clipboard with automatically add a CF_UNICODETEXT to the clipboard when not CF_UNICODETEXT already exists. Since the BinaryClipPut function clears existing data before adding new data, specifying 0 or not specifying the preserve-data parameter at all causes both CF_TEXT and CF_UNICODETEXT data to be added to the clipboard when you specify just CF_TEXT.  However, if you subsequently add new CF_TEXT data to the clipboard with the function's preserve-data set to 1, the CF_TEXT data will be replaced but the previous CF_UNICODETEXT text will remain unchanged.  In other words, the CF_TEXT and CF_UNICODETEXT format contents will no longer be synchronized.

Example:


file = "c:\b\1clip.bmp"
format = 8
size = FileSize(file)
buf = BinaryAlloc(size)
BinaryRead(buf, file)
rc = BinaryClipPut(buf, format)
Message("BinaryClipPut returned", rc)
See Also:

Binary Operations, BinaryAlloc, BinaryWrite, BinaryFree, BinaryClipGet