Jump to content

WinQueryClipbrdData: Difference between revisions

From EDM2
Created page with "This function obtains a handle to the current clipboard data with a specified format. ==Syntax== WinQueryClipbrdData(hab, fmt) ==Parameters== ;hab (HAB) - input :Anchor-blo..."
 
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 5: Line 5:


==Parameters==
==Parameters==
;hab (HAB) - input
;''hab'' (HAB) - input:Anchor-block handle.
: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:
:{| class="wikitable"
|-
| 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.
|}


:;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==
==Returns==
;ulRet (ULONG) - returns
;''ulRet'' (ULONG) - returns:Handle to the clipboard data.
:Handle to the clipboard data.
:;Format does not exist, or an error occurred
:;Format does not exist, or an error occurred
:;Other
:;Other
::Handle to the clipboard data.
::Handle to the clipboard data.
==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==
This example obtains a handle to the current clipboard data of text format.
Definition:
<pre>
#define INCL_WINCLIPBOARD
#include <OS2.H>
HAB hab;
/* . */
ULONG hclipbrdData;
 
hclipbrdData = WinQueryClipbrdData(hab, CF_TEXT);
 
</pre>
 
Definition
<pre>
<pre>
#define INCL_WINCLIPBOARD /* Or use INCL_WIN, INCL_PM, */
#define INCL_WINCLIPBOARD /* Or use INCL_WIN, INCL_PM, */
Line 60: Line 47:


ulRet = WinQueryClipbrdData(hab, fmt);
ulRet = WinQueryClipbrdData(hab, fmt);
</pre>
This example obtains a handle to the current clipboard data of text format.
<pre>
#define INCL_WINCLIPBOARD
#include <os2.h>


HAB hab;
/* . */
ULONG hclipbrdData;
hclipbrdData = WinQueryClipbrdData(hab, CF_TEXT);
</pre>
</pre>
== Related Messages==
* [[WM_RENDERFMT]]
* [[WM_PAINTCLIPBOARD]]


==Related Functions==
==Related Functions==
Line 74: Line 75:
* [[WinSetClipbrdOwner]]
* [[WinSetClipbrdOwner]]
* [[WinSetClipbrdViewer]]
* [[WinSetClipbrdViewer]]
[[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