Clipboard Viewer Component

   
Release: 1.3
Date: 17 Aug 2008
Delphi Compatibility:
 D1   D2   D3   D4   D5   D6   D7  D2005
(Win32)
D2006
(Win32)
D2007 D2009
(Win32)
D2010
(Win32)
Red LED Green LED Green LED Green LED Green LED Green LED Green LED Grey LED Grey LED Grey LED Grey LED Grey LED

Overview

TPJCBView is a non-visual Delphi component which registers a hidden window as a "clipboard viewer".

This means that Windows notifies the component whenever the clipboard contents change. On receipt of these notifications the component triggers an event. By handling the event your application can respond to changes on the clipboard. The component can be used as the heart of a program that displays "live" information about the clipboard. Alternatively it can simply enable and disable other components whose state depends on the available clipboard formats.

TPJCBView provides an Enabled property that is used to enable and disable the component and hence it's events. It also has a TriggerOnCreation property that triggers an event when the control is created.

How it works

TPJCBView works by registering its hidden window with Windows. This is accomplished by using the SetClipboardViewer API call that adds the window to the clipboard chain. The component then handles the WM_DRAWCLIPBOARD message that Windows sends to the hidden window when the clipboard changes. The WM_CHANGECBCHAIN message that indicates when the viewer chain has changed is also handled.

Two of my articles provide details of two of the key techniques used in developing this component:

Help files

An OpenHelp compatible help file is provided that can be integrated into the IDE in Delphi 3 to 7. The help file is not compatible with Delphi 2 or the Borland Development System.