Jump to content

WinSetClipbrdOwner: Difference between revisions

From EDM2
Created page with "This function sets the current clipboard-owner window. ==Syntax== WinSetClipbrdOwner( ''hab'', ''hwnd'' ) ==Parameters== ;hab (HAB) - input :Anchor-block handle. ;hwnd (H..."
 
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
This function sets the current clipboard-owner window.  
This function sets the current clipboard-owner window.
 
==Syntax==
==Syntax==
WinSetClipbrdOwner( ''hab'', ''hwnd'' )
WinSetClipbrdOwner( ''hab'', ''hwnd'' )


==Parameters==  
==Parameters==
;hab (HAB) - input
;''hab'' (HAB) - input:Anchor-block handle.
: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.
;hwnd (HWND) - input
::Other: Window handle of the new clipboard owner.
: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==
==Returns==
;rc (BOOL) - returns
;''rc'' (BOOL) - returns:Success indicator.
:Success indicator.
::TRUE: Successful completion
:;TRUE
::FALSE: Error occurred.
::Successful completion  
:;FALSE
::Error occurred.


==Errors==
==Errors==
Possible returns from WinGetLastError
Possible returns from [[WinGetLastError]]
:;PMERR_INVALID_HWND (0x1001)
:PMERR_INVALID_HWND (0x1001) An invalid window handle was specified.
::An invalid window handle was specified.


==Remarks==
==Remarks==
The clipboard owner window receives the following clipboard-related messages at appropriate times:
The clipboard owner window receives the following clipboard-related messages at appropriate times:
* WM_DESTROYCLIPBOARD
* [[WM_DESTROYCLIPBOARD]]
* WM_HSCROLLCLIPBOARD
* [[WM_HSCROLLCLIPBOARD]]
* WM_PAINTCLIPBOARD
* [[WM_PAINTCLIPBOARD]]
* WM_RENDERALLFMTS
* [[WM_RENDERALLFMTS]]
* WM_RENDERFMT
* [[WM_RENDERFMT]]
* WM_SIZECLIPBOARD
* [[WM_SIZECLIPBOARD]]
* WM_VSCROLLCLIPBOARD.
* [[WM_VSCROLLCLIPBOARD]]


==Example Code==
==Example Code==
Definition:
This example places a bit map into the clipboard.
<pre>
<pre>
#define INCL_WINCLIPBOARD /* Or use INCL_WIN, INCL_PM, */
#define INCL_WINCLIPBOARD
#include <os2.h>
#include <os2.h>


HAB    hab;  /*  Anchor-block handle. */
HAB hab;         /* anchor-block handle. */
HWND    hwnd;  /*  Window handle of the new clipboard owner. */
HBITMAP bmap;     /* bit-map handle.     */
BOOL    rc;    /*  Success indicator. */
 
rc = WinSetClipbrdOwner(hab, hwnd);
</pre>
This example places a bit map into the clipboard.
<pre>
#define INCL_WINCLIPBOARD
#include <OS2.H>
HAB hab;                 /* anchor-block handle. */
HBITMAP bmap;           /* bit-map handle.     */
HWND hwnd;
HWND hwnd;


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


==Related Functions==
==Related Functions==
*[[WinCloseClipbrd]]
* [[WinCloseClipbrd]]
*[[WinEmptyClipbrd]]
* [[WinEmptyClipbrd]]
*[[WinEnumClipbrdFmts]]
* [[WinEnumClipbrdFmts]]
*[[WinOpenClipbrd]]
* [[WinOpenClipbrd]]
*[[WinQueryClipbrdData]]
* [[WinQueryClipbrdData]]
*[[WinQueryClipbrdFmtInfo]]
* [[WinQueryClipbrdFmtInfo]]
*[[WinQueryClipbrdOwner]]
* [[WinQueryClipbrdOwner]]
*[[WinQueryClipbrdViewer]]
* [[WinQueryClipbrdViewer]]
*[[WinSetClipbrdData]]
* [[WinSetClipbrdData]]
*[[WinSetClipbrdViewer]]
* [[WinSetClipbrdViewer]]
 
== Related Messages==
* WM_DESTROYCLIPBOARD
* WM_HSCROLLCLIPBOARD
* WM_PAINTCLIPBOARD
* WM_RENDERALLFMTS
* WM_RENDERFMT
* WM_SIZECLIPBOARD
* WM_VSCROLLCLIPBOARD


[[Category:Win]]
[[Category:Win]]

Latest revision as of 19:14, 10 April 2025

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:

Example Code

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