SetClipboardViewer Function

The SetClipboardViewer function adds the specified window to the chain of clipboard viewers. Clipboard viewer windows receive a WM_DRAWCLIPBOARD message whenever the content of the clipboard changes.

Syntax

HWND SetClipboardViewer(      
    HWND hWndNewViewer );

Parameters

hWndNewViewer
[in] Handle to the window to be added to the clipboard chain.

Return Value

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.

Remarks

The windows that are part of the clipboard viewer chain, called clipboard viewer windows, must process the clipboard messages WM_CHANGECBCHAIN and WM_DRAWCLIPBOARD. Each clipboard viewer window calls the SendMessage function to pass these messages to the next window in the clipboard viewer chain.

A clipboard viewer window must eventually remove itself from the clipboard viewer chain by calling the ChangeClipboardChain function — for example, in response to the WM_DESTROY message.

For an example, see Adding a Window to the Clipboard Viewer Chain.

Function Information

Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systems Windows 95, Windows NT 3.1
UnicodeImplemented as Unicode version.

See Also

Tags :


Community Content

Noelle Mallory - MSFT
Clipboard activity monitor with Compact Framework

Hi !

I would like to know if there is an equivalent of the SetClipboardViewer function on the .NET compact framework.

Background : I write an application for a WM6 pocket PC in C# that runs in the background and should check the contents of the clipboard whenever its contents has been changed by any other application running on the device.

Several posts explain how to do that for the "full framework" by using User32.dll SetClipboardViewer described in this article:

http://www.codeguru.com/csharp/.net/net_general/tipstricks/article.php/c7315/


http://www.developer.com/net/csharp/article.php/3359891

http://www.radsoftware.com.au/articles/clipboardmonitor.aspx

However, I can't find the equivalent of SetClipboardViewer in the CF.

Any suggestion is welcome. Thanks for your time !

Fabien

[Noelle Mallory - MSFT] Please post questions to the MSDN Forums at http://forums.microsoft.com/msdn. You will likely get a quicker response through the forum than through the Community Content.


Halomfalom
Great....
This clipboard notification chain works great for your own applications... until some other application doesn't process WM_CHANGECBCHAIN properly or doesn't call ChangeClipboardChain() before it exits. I mean, when that happens it's not Microsoft's fault that some other application broke the chain on me, right? It's perfectly reasonable for an API to have a linked list of observers and to require that the observers themselves maintain the integrity of the list, right?
Tags :

Page view tracker