WinSetClipbrdViewer: Difference between revisions
Appearance
mNo edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 4: | Line 4: | ||
WinSetClipbrdViewer( ''hab'', ''hwndNewClipViewer'' ) | WinSetClipbrdViewer( ''hab'', ''hwndNewClipViewer'' ) | ||
==Parameters== | ==Parameters== | ||
;hab (HAB) - input:Anchor-block handle. | ;''hab'' (HAB) - input:Anchor-block handle. | ||
;hwndNewClipViewer (HWND) - input:Window handle of the new clipboard viewer. | ;''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. | ::NULLHANDLE: The clipboard-viewer window is released and no new clipboard-viewer window is established. | ||
::Other: Window handle of the new clipboard viewer. | ::Other: Window handle of the new clipboard viewer. | ||
==Returns== | ==Returns== | ||
;rc (BOOL) - returns:Success indicator. | ;''rc'' (BOOL) - returns:Success indicator. | ||
::TRUE: Valid, new clipboard-viewer window established | ::TRUE: Valid, new clipboard-viewer window established | ||
::FALSE: There is no new clipboard-viewer window established. | ::FALSE: There is no new clipboard-viewer window established. | ||
==Errors== | ==Errors== | ||
Possible returns from WinGetLastError | Possible returns from [[WinGetLastError]] | ||
:PMERR_INVALID_HWND (0x1001) An invalid window handle was specified. | :PMERR_INVALID_HWND (0x1001) An invalid window handle was specified. | ||
==Remarks== | ==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-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. | The clipboard must be open before this function is invoked. | ||
Line 31: | Line 31: | ||
ULONG hclipbrdData; | ULONG hclipbrdData; | ||
HAB hab; | HAB hab; /* anchor-block handle. */ | ||
HBITMAP bmap; | HBITMAP bmap; /* bit-map handle. */ | ||
HWND hwnd; | HWND hwnd; | ||
WinOpenClipbrd(hab); | WinOpenClipbrd(hab); | ||
WinSetClipbrdViewer(hab, | WinSetClipbrdViewer(hab, | ||
hwnd); /* window handle of the clipboard */ | |||
/* viewer. */ | |||
hclipbrdData = WinQueryClipbrdData(hab, | hclipbrdData = WinQueryClipbrdData(hab, | ||
CF_TEXT); | CF_TEXT); | ||
WinCloseClipbrd(hab); | WinCloseClipbrd(hab); | ||
</pre> | </pre> | ||
== Related Messages== | |||
* [[WM_DRAWCLIPBOARD]] | |||
==Related Functions== | ==Related Functions== | ||
*[[WinCloseClipbrd]] | * [[WinCloseClipbrd]] | ||
*[[WinEmptyClipbrd]] | * [[WinEmptyClipbrd]] | ||
*[[WinEnumClipbrdFmts]] | * [[WinEnumClipbrdFmts]] | ||
*[[WinOpenClipbrd]] | * [[WinOpenClipbrd]] | ||
*[[WinQueryClipbrdData]] | * [[WinQueryClipbrdData]] | ||
*[[WinQueryClipbrdFmtInfo]] | * [[WinQueryClipbrdFmtInfo]] | ||
*[[WinQueryClipbrdOwner]] | * [[WinQueryClipbrdOwner]] | ||
*[[WinQueryClipbrdViewer]] | * [[WinQueryClipbrdViewer]] | ||
*[[WinSetClipbrdData]] | * [[WinSetClipbrdData]] | ||
*[[WinSetClipbrdOwner]] | * [[WinSetClipbrdOwner]] | ||
[[Category:Win]] | [[Category:Win]] |
Latest revision as of 19:15, 10 April 2025
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
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);