Clipboard Viewer


Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

Clipboard Viewer

The following tool shows a simple Clipboard viewer application. There are several examples of Clipboard usage in MSDN documents. With them, I have made this tool as a spy to understand and debug Clipboard exchanges. It uses a particular feature of linking an application with the Windows Clipboard to allow you to make a viewer.

This tool displays the Clipboard data format available and allows you to choose to display corresponding data in real time (at the time it was taken in Clipboard). It's possible to display it in hexa format or, if for several formats, in a true format (for example: image for dib or bitmap, text for simple text format). This program is also an example of Clipboard usage with Windows MFC.

Clipboard Viewer Windows (Microsoft Aide)

A Clipboard viewer window displays the current content of the Clipboard and receives messages when the Clipboard content changes. To create a Clipboard viewer window, your application must do the following:

  • Add the window to the clipboard viewer chain.
  • Process the WM_CHANGECBCHAIN message.
  • Process the WM_DRAWCLIPBOARD message.
  • Remove the window from the Clipboard viewer chain before it is destroyed.

A window adds itself to the Clipboard viewer chain by calling the SetClipboardViewer function. The return value is the handle to the next window in the chain. To retrieve the handle to the first window in the chain, call the GetClipboardViewer function. Each Clipboard viewer window must keep track of the next window in the Clipboard viewer chain. When the contents of the Clipboard changes, the system sends a WM_DRAWCLIPBOARD message to the first window in the chain.

After updating its display, each Clipboard viewer window must pass this message on to the next window in the chain. Before closing, a Clipboard viewer window must remove itself from the Clipboard viewer chain by calling the ChangeClipboardChain function. The system then sends a WM_CHANGECBCHAIN message to the first window in the chain.

About the Author

Georges Dumond

Courbevoie (France)



  • Clipboard Viewer

    Posted by suzannguyen on 04/19/2005 05:21am

    A Window adds itself to the clipboard viewer chain by calling the SetClipboardViewer function. I don't know what the return value is.

    • Clipboard Viewer + Dailog

      Posted by Msm on 09/01/2008 11:14am

      Hello Sir I read your artical it is very usefull for me.But i want to do in the dailog application.Sir i want to show it's out put on dailog application.Sir how can i change this sir plz help me

    • Return value of the SetClipboardViewer function

      Posted by Cassonnet on 04/19/2005 08:45am

      If the function succeeds, the return value identifies the next window in the clipboard viewer chain. If an error occurs or there are no other windows in the clipboard viewer chain, the return value is NULL. To get extended error information, call GetLastError.

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date