Jump to content

WinQueryClipbrdData: Difference between revisions

From EDM2
m Martini moved page WinQueryClipBrdData to WinQueryClipbrdData without leaving a redirect
Ak120 (talk | contribs)
mNo edit summary
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:
::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.
This example obtains a handle to the current clipboard data of text format.
<pre>
<pre>
#define INCL_WINCLIPBOARD
#define INCL_WINCLIPBOARD
#include <OS2.H>
#include <os2.h>
 
HAB hab;
HAB hab;
/* . */
/* . */
Line 47: Line 38:


hclipbrdData = WinQueryClipbrdData(hab, CF_TEXT);
hclipbrdData = WinQueryClipbrdData(hab, CF_TEXT);
</pre>
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>
</pre>


Line 78: Line 55:
* WM_RENDERFMT
* WM_RENDERFMT
* WM_PAINTCLIPBOARD
* WM_PAINTCLIPBOARD
[[Category:Win]]
[[Category:Win]]

Revision as of 13:40, 13 December 2023

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

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 Functions

Related Messages

  • WM_RENDERFMT
  • WM_PAINTCLIPBOARD