CLIPBOARD statement  

Purpose

Transfer data to/from the Windows ClipBoard.

Syntax

CLIPBOARD GET ITEM itemfmt TO vItem
CLIPBOARD GET TEXT TO vText$
CLIPBOARD RESET TO vSuccess
CLIPBOARD SET ITEM itemfmt, hItem TO vSuccess
CLIPBOARD SET TEXT StrExpr TO vSuccess

Remarks

The Windows ClipBoard provides support for the transfer of various types of data between applications, or even different parts of a single application.  The concept is simple -- save some data in the ClipBoard and retrieve it later.  But keep in mind that the ClipBoard can only hold one data item at a time.  When it's overwritten by a new data item, the previous data is lost forever.  In many cases, it's just used to transfer plain text.  In that case, you can just read and write a string to make the transfer.  The other possible data types are listed below.

There are five general forms of the CLIPBOARD statement:

CLIPBOARD GET ITEM

A data item is retrieved from the CLIPBOARD, and assigned to the LONG or DWORD variable specified by vItem.  The data item is assumed to be in the format specified by itemfmt.  See the format definitions below.

CLIPBOARD GET TEXT

A text string is retrieved from the CLIPBOARD, and assigned to the string variable specified by vText$. If no text can be retrieved, a nul (zero-length) string is assigned instead.

CLIPBOARD RESET

The contents of the CLIPBOARD are deleted.  If the operation is successful, the LONG or DWORD variable specified by vSuccess is assigned the value TRUE (non-zero).  If it fails for any reason, the value FALSE (0) is assigned instead.

CLIPBOARD SET ITEM

A new data item, specified by hItem, is stored in the CLIPBOARD.  Any previous contents are deleted. The data item is assumed to be in the format specified by itemfmt.  See the format definitions below.  If the operation is successful, the LONG or DWORD variable specified by vSuccess is assigned the value TRUE (non-zero).  If it fails for any reason, the value FALSE (0) is assigned instead.

CLIPBOARD SET TEXT

A new text string, specified by StrExpr, is stored in the CLIPBOARD.  Any previous contents are deleted. If the operation is successful, the LONG or DWORD variable specified by vSuccess is assigned the value TRUE (non-zero).  If it fails for any reason, the value FALSE (0) is assigned instead.

The following equates define the various CLIPBOARD formats, and are used as the itemfmt parameter.  All of these equates are predefined in the PowerBASIC compiler.

%CF_BITMAP

A handle to a bitmap (HBITMAP).

%CF_DIB

A memory object containing a BITMAPINFO structure followed by the bitmap bits.

%CF_DIF

Software Arts' Data Interchange Format.

%CF_ENHMETAFILE

A handle of an enhanced metafile (HENHMETAFILE).

%CF_HDROP

A handle of type HDROP that identifies a list of files.

%CF_LOCALE

The data is a handle to the locale identifier associated with text in the clipboard.

%CF_METAFILEPICT

Handle of a metafile picture format as defined by the METAFILEPICT structure.

%CF_OEMTEXT

Text format containing characters in the OEM character set. Each line ends with a carriage return/linefeed (CR-LF) combination. A null character signals the end of the data.

%CF_PALETTE

Handle of a color palette.

%CF_PENDATA

Data for the pen extensions to the Microsoft Windows for Pen Computing.

%CF_RIFF

Represents audio data more complex than can be represented in a CF_WAVE standard wave format.

%CF_SYLK

Microsoft Symbolic Link (SYLK) format.

%CF_TEXT

Text format. Each line ends with a carriage return/linefeed (CR-LF) combination.  A null character signals the end of the data.  This is the format used automatically by CLIPBOARD GET/SET TEXT.

%CF_TIFF

Tagged-image file format.

%CF_UNICODETEXT

Unicode text format. Each line ends with a carriage return/linefeed (CR-LF) combination.  A null character signals the end of the data.

%CF_WAVE

Represents audio data in one of the standard wave formats, such as 11 kHz or 22 kHz pulse code modulation (PCM).