![]() |
Source Code |
![]() |
![]() |
3 | Code Libraries |   |
Customising Clipboard Use |
Receive clipboard change notifications and get full control over reading, writing and adding formats |
NOTE:
this code has been superceded by the version at the new site.
|
  |
Introduction
![]() The Clipboard Change Notification Class (cClipboardViewer) An application can be notified of changes in the data stored in the clipboard by registering itself as a Win32 Clipboard Viewer. Having done this, the application is then notified of changes in the clipboard by the WM_DRAWCLIPBOARD message. Your application becomes part of a chain of applications on the system which respond to this message, and is responsible for forwarding the message after reading it to the next application along. To do this, your application must store the next window along in the chain to forward messages to and also respond to the WM_CHANGECBCHAIN message which is sent whenever any other clipboard viewer on the system is added or removed to ensure the next window along is valid. This functionality is provided in the download code by the cClipboardViewer class. This uses the Subclassing and Timer DLL to intercept WM_DRAWCLIPBOARD and WM_CHANGECBCHAIN messages and to provide the required message passing and chain fixing functions. To use this class you only need to make two calls:
![]() The Custom Clipboard read/write class (cCustomClipboard) This class encapsulates the Win32 API Clipboard functions. The following table details the methods and properties of the class:
To see how to use these methods to implement clipboard copy and paste for non-standard formats,
download the RTF Clipboard Copy and Paste sample. This demonstrates how to add
complete custom clipboard format in about 10 or so lines of code.
|
  |
![]() |
|
About Contribute Send Feedback Privacy
|