[Classes] [Prev] [Next] [Methods]

CClipboard

Methods Index

Heritage
Description
Usage
Public Methods
Constructor and Destructor Methods
Stream Retrieval Methods
Clipboard Methods
Protected Methods

CClipboard


Heritage

Superclass: None

Subclass: None


Description

The CClipboard is used to cut and paste data to and from the native- system clipboard. A CClipboard is not a visible object; it is a representation of the native clipboard. The CClipboard has methods to obtain streams for putting and getting data to and from the native clipboard. These clipboard streams must be used to stream to and from the CClipboard. The clipboard can be opened in either read or write mode but not both.


Usage

To use CClipboard you need to create a CClipboard object in either CB_READ or CB_WRITE mode. If the mode is CB_READ, data will be read from the native clipboard when an input stream is retrieved. If the mode is CB_WRITE, the data will be put on the native clipboard when the CClipboard object is destroyed or if the Flush( ) method is called.

To stream data to or from the native clipboard, retrieve a stream object of the appropriate type from the CClipboard object.

Here is an example:

CClipboard aCB; //CBWRITE mode is the default
CClipboardApplOStream * aApplStr =
aCB.GetApplOStream("MYMN"); //MYMN is the name of
the data
CClipboardTextOStream * aTextStr = aCB.GetTextOStream();
CClipboardPictOStream * aPictStr = aCB.GetPictOStream();

*aApplStr << MyBinaryData; // Streaming out binary data
*aTextStr << "My Text"; // Streaming out text
*aPictStr << myPict; // Streaming out a PICTURE
Since we have left scope, the CClipboard was deleted and the data was flushed to the system clipboard. We could have also called aCB.Flush(); to flush the data to the clipboard.

You can follow a similar path to read data from the native clipboard. Remember, the data will be retrieved from the clipboard when the instream is asked for.

CClipboard aCB(CB_READ);
CClipboardApplIStream * aApplStr =
aCB.GetApplIStream("MYMN"); // MYMN is the name of
the data
CClipboardTextIStream * aTextStr = aCB.GetTextIStream();
CClipboardPictIStream * aPictStr = aCB.GetPictIStream();

*aApplStr myNewBinaryData; // Streaming in binary data
*aTextStr myTextBuf; // Streaming in text
*aPictStr myNewPict; // Streaming in a PICTURE

Public Methods

Constructor and Destructor Methods

CClipboard(CBMode theMode = CB_WRITE);
~CClipboard( );

Stream Retrieval Methods

CClipboardTextIStream * GetTextIStream( );
CClipboardTextOStream * GetTextOStream( );
CClipboardApplIStream * GetApplIStream(const char * theName);
CClipboardApplOStream * GetApplOStream(const char * theName);
CClipboardPictIStream * GetPictIStream( );
CClipboardPictOStream * GetPictOStream( );

Clipboard Methods

static BOOLEAN HasFormat(CB_FORMAT format, char * theName = NULL);
void Flush( );
CBMode GetMode( );

Protected Methods

None.



[Classes] [Prev] [Next] [Methods]

support@xvt.com


Visit our online help desk for tech support

Copyright © 2009, Providence Software Solutions Inc. All rights reserved.