Jump to content

WinQueryClipbrdData: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
No edit summary
 
Line 5: Line 5:


==Parameters==
==Parameters==
;hab (HAB) - input:Anchor-block handle.
;''hab'' (HAB) - input:Anchor-block handle.
;fmt (ULONG) - input:Format of the data to be accessed.
;''fmt'' (ULONG) - input:Format of the data to be accessed.
:In addition to the predefined formats, private formats can be created using the standard system atom manager. The following is the list of standard clipboard formats:
:In addition to the predefined formats, private formats can be created using the standard system atom manager. The following is the list of standard clipboard formats:
::CF_TEXT: Text format. Each line ends with a carriage-return/line-feed combination. Tab characters separate fields within a line. A NULL character signals the end of the data.
:{| class="wikitable"
::CF_DSPTEXT: Text display format associated with private format.
|-
::CF_BITMAP: Bit map.
| CF_TEXT || Text format. Each line ends with a carriage-return/line-feed combination. Tab characters separate fields within a line. A NULL character signals the end of the data.
::CF_DSPBITMAP: Bit-map display format associated with private format.
|-
::CF_METAFILE: Metafile.
| CF_DSPTEXT || Text display format associated with private format.
::CF_DSPMETAFILE: Metafile display format associated with private format.
|-
::CF_PALETTE: Palette.
| CF_BITMAP || Bit map.
|-
| CF_DSPBITMAP || Bit-map display format associated with private format.
|-
| CF_METAFILE || Metafile.
|-
| CF_DSPMETAFILE || Metafile display format associated with private format.
|-
| CF_PALETTE || Palette.
|}


==Returns==
==Returns==
;ulRet (ULONG) - returns:Handle to the clipboard data.
;''ulRet'' (ULONG) - returns:Handle to the clipboard data.
:;Format does not exist, or an error occurred
:;Format does not exist, or an error occurred
:;Other
:;Other
Line 23: Line 32:


==Remarks==
==Remarks==
The returned data handle must not be used after the WinCloseClipbrd function is called. For this reason, the application must either copy the data (if required for long-term use) or process the data before the WinCloseClipbrd function is called. The application must neither free the data handle itself, nor leave it locked in any way.
The returned data handle must not be used after the [[WinCloseClipbrd]] function is called. For this reason, the application must either copy the data (if required for long-term use) or process the data before the WinCloseClipbrd function is called. The application must neither free the data handle itself, nor leave it locked in any way.


Information about the format of the data in the clipboard can be obtained from WinQueryClipbrdFmtInfo.
Information about the format of the data in the clipboard can be obtained from [[WinQueryClipbrdFmtInfo]].


==Example Code==
==Example Code==
Definition:
<pre>
#define INCL_WINCLIPBOARD /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>
HAB      hab;    /*  Anchor-block handle. */
ULONG    fmt;    /*  Format of the data to be accessed. */
ULONG    ulRet;  /*  Handle to the clipboard data. */
ulRet = WinQueryClipbrdData(hab, fmt);
</pre>
This example obtains a handle to the current clipboard data of text format.
This example obtains a handle to the current clipboard data of text format.
<pre>
<pre>
Line 39: Line 59:
hclipbrdData = WinQueryClipbrdData(hab, CF_TEXT);
hclipbrdData = WinQueryClipbrdData(hab, CF_TEXT);
</pre>
</pre>
== Related Messages==
* [[WM_RENDERFMT]]
* [[WM_PAINTCLIPBOARD]]


==Related Functions==
==Related Functions==
Line 51: Line 75:
* [[WinSetClipbrdOwner]]
* [[WinSetClipbrdOwner]]
* [[WinSetClipbrdViewer]]
* [[WinSetClipbrdViewer]]
== Related Messages==
* WM_RENDERFMT
* WM_PAINTCLIPBOARD


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

Latest revision as of 19:06, 10 April 2025

This function obtains a handle to the current clipboard data with a specified format.

Syntax

WinQueryClipbrdData(hab, fmt)

Parameters

hab (HAB) - input
Anchor-block handle.
fmt (ULONG) - input
Format of the data to be accessed.
In addition to the predefined formats, private formats can be created using the standard system atom manager. The following is the list of standard clipboard formats:
CF_TEXT Text format. Each line ends with a carriage-return/line-feed combination. Tab characters separate fields within a line. A NULL character signals the end of the data.
CF_DSPTEXT Text display format associated with private format.
CF_BITMAP Bit map.
CF_DSPBITMAP Bit-map display format associated with private format.
CF_METAFILE Metafile.
CF_DSPMETAFILE Metafile display format associated with private format.
CF_PALETTE Palette.

Returns

ulRet (ULONG) - returns
Handle to the clipboard data.
Format does not exist, or an error occurred
Other
Handle to the clipboard data.

Remarks

The returned data handle must not be used after the WinCloseClipbrd function is called. For this reason, the application must either copy the data (if required for long-term use) or process the data before the WinCloseClipbrd function is called. The application must neither free the data handle itself, nor leave it locked in any way.

Information about the format of the data in the clipboard can be obtained from WinQueryClipbrdFmtInfo.

Example Code

Definition:

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

HAB      hab;    /*  Anchor-block handle. */
ULONG    fmt;    /*  Format of the data to be accessed. */
ULONG    ulRet;  /*  Handle to the clipboard data. */

ulRet = WinQueryClipbrdData(hab, fmt);

This example obtains a handle to the current clipboard data of text format.

#define INCL_WINCLIPBOARD
#include <os2.h>

HAB hab;
/* . */
ULONG hclipbrdData;

hclipbrdData = WinQueryClipbrdData(hab, CF_TEXT);

Related Messages

Related Functions