Jump to content

WinSetClipbrdOwner

From EDM2
Revision as of 03:55, 24 December 2023 by Martini (talk | contribs) (Created page with "This function sets the current clipboard-owner window. ==Syntax== WinSetClipbrdOwner( ''hab'', ''hwnd'' ) ==Parameters== ;hab (HAB) - input :Anchor-block handle. ;hwnd (H...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function sets the current clipboard-owner window.

Syntax

WinSetClipbrdOwner( hab, hwnd )

Parameters

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

Returns

rc (BOOL) - returns
Success indicator.
TRUE
Successful completion
FALSE
Error occurred.

Errors

Possible returns from WinGetLastError

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

Remarks

The clipboard owner window receives the following clipboard-related messages at appropriate times:

  • WM_DESTROYCLIPBOARD
  • WM_HSCROLLCLIPBOARD
  • WM_PAINTCLIPBOARD
  • WM_RENDERALLFMTS
  • WM_RENDERFMT
  • WM_SIZECLIPBOARD
  • WM_VSCROLLCLIPBOARD.

Example Code

Definition:

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

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

rc = WinSetClipbrdOwner(hab, hwnd);

This example places a bit map into the clipboard.

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

WinOpenClipbrd(hab);
WinSetClipbrdOwner(hab,
                   hwnd); /* window handle of the clipboard */
                          /* owner.                         */
WinSetClipbrdData(hab,
                 (ULONG)bmap,
                 CF_BITMAP,
                 CFI_HANDLE); /* tells the system that the  */
                               /* bmap parameter is a handle */
                               /* to a bit map.              */
WinCloseClipbrd(hab);

Related Functions

Related Messages

  • WM_DESTROYCLIPBOARD
  • WM_HSCROLLCLIPBOARD
  • WM_PAINTCLIPBOARD
  • WM_RENDERALLFMTS
  • WM_RENDERFMT
  • WM_SIZECLIPBOARD
  • WM_VSCROLLCLIPBOARD