Jump to content

WinSetClipbrdViewer

From EDM2
Revision as of 04:00, 24 December 2023 by Martini (talk | contribs) (Created page with "This function sets the current clipboard-viewer window to a specified window. ==Syntax== WinSetClipbrdViewer( ''hab'', ''hwndNewClipViewer'' ) ==Parameters== ;hab (HAB) - i...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function sets the current clipboard-viewer window to a specified window.

Syntax

WinSetClipbrdViewer( hab, hwndNewClipViewer )

Parameters

hab (HAB) - input
Anchor-block handle.
hwndNewClipViewer (HWND) - input
Window handle of the new clipboard viewer.
NULLHANDLE
The clipboard-viewer window is released and no new clipboard-viewer window is established.
Other
Window handle of the new clipboard viewer.

Returns

rc (BOOL) - returns
Success indicator.
TRUE
Valid, new clipboard-viewer window established
FALSE
There is no new clipboard-viewer window established.

Errors

Possible returns from WinGetLastError

PMERR_INVALID_HWND (0x1001)
An invalid window handle was specified.

Remarks

The clipboard-viewer window receives the WM_DRAWCLIPBOARD message when the contents of the clipboard change. This allows the viewer window to display an up-to-date version of the clipboard contents.

The clipboard must be open before this function is invoked.

Example Code

Definition:

#define INCL_WINCLIPBOARD /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HAB     hab;                /*  Anchor-block handle. */
HWND    hwndNewClipViewer;  /*  Window handle of the new clipboard viewer. */
BOOL    rc;                 /*  Success indicator. */

rc = WinSetClipbrdViewer(hab, hwndNewClipViewer);

This example shows how a window views the clipboard contents.

#define INCL_WINCLIPBOARD
#include <OS2.H>
ULONG hclipbrdData;
HAB hab;                 /* anchor-block handle. */
HBITMAP bmap;            /* bit-map handle.      */
HWND hwnd;

WinOpenClipbrd(hab);
WinSetClipbrdViewer(hab,
                   hwnd); /* window handle of the clipboard */
                          /* viewer.                        */
hclipbrdData = WinQueryClipbrdData(hab,
                                   CF_TEXT);
WinCloseClipbrd(hab);

Related Functions

Related Messages

  • WM_DRAWCLIPBOARD