WinQueryClipbrdFmtInfo: Difference between revisions
Appearance
Created page with "This function determines whether a particular format of data is present in the clipboard, and if so, provides information about that format. ==Syntax== WinQueryClipbrdFmtInf..." |
No edit summary |
||
(One intermediate revision by one other user 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 queried. | ||
;fmt (ULONG) - input | |||
:Format of the data to be queried. | |||
: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" | |||
|- | |||
! Format Name !! Description | |||
|- | |||
| CF_BITMAP || Bit map. | |||
|- | |||
| CF_DSPBITMAP || Bit-map display format associated with private format. | |||
|- | |||
| CF_DSPMETAFILE || Metafile display format associated with private format. | |||
|- | |||
| CF_DSPTEXT || Text display format associated with private format. | |||
|- | |||
| CF_METAFILE || Metafile. | |||
|- | |||
| CF_PALETTE || Palette. | |||
;prgfFmtInfo (PULONG) - output | |- | ||
| 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. | |||
|} | |||
;''prgfFmtInfo'' (PULONG) - output:Memory model and usage flags. | |||
:These are the usage flags set by the setting application; that is, the CFI_* flags of the flFmtInfo parameter of the [[WinSetClipbrdData]] function. | |||
:If the format is CF_BITMAP, CF_DSPBITMAP, CF_METAFILE or CF_DSPMETAFILE, prgfFmtInfo is set to CFI_HANDLE. If the format is CF_TEXT or CF_DSPTEXT, prgfFmtInfo is set to CFI_POINTER. If the format is user-defined, prgfFmtInfo is set to the value used in the [[WinSetClipbrdData]] function. | |||
==Returns== | ==Returns== | ||
;rc (BOOL) - returns | ;''rc'' (BOOL) - returns:Format-exists indicator. | ||
:Format-exists indicator. | ::TRUE - ''fmt'' exists in the clipboard and ''prgfFmtInfo'' is set | ||
::FALSE - ''fmt'' does not exist in the clipboard and ''prgfFmtInfo'' is not set. | |||
==Remarks== | ==Remarks== | ||
This function does not cause the data to be rendered. | This function does not cause the data to be rendered. | ||
Applications can put information in the clipboard in their own private format. Use the following function calls to create and query a private format: | Applications can put information in the clipboard in their own private format. Use the following function calls to create and query a private format: | ||
<pre> | |||
fDataPlaced = WinSetClipbrdData(hab, ulh, | |||
WinAddAtom(WinQuerySystemAtomTable(), | |||
"Private Data Type"), | |||
flFmtInfo); | |||
ulData = WinQueryClipbrdData(hab, | |||
WinFindAtom(WinQuerySystemAtomTable(), | WinFindAtom(WinQuerySystemAtomTable(), | ||
"Private Data Type")); | |||
</pre> | |||
==Example Code== | ==Example Code== | ||
Line 61: | Line 54: | ||
<pre> | <pre> | ||
#define INCL_WINCLIPBOARD | #define INCL_WINCLIPBOARD | ||
#include < | #include <os2.h> | ||
HAB hab; | HAB hab; | ||
Line 69: | Line 62: | ||
if (WinQueryClipbrdData(hab,CF_TEXT)) | if (WinQueryClipbrdData(hab,CF_TEXT)) | ||
{ | |||
hclipbrdData = WinQueryClipbrdFmtInfo(hab, | |||
CF_TEXT, | |||
&format); | |||
} | |||
</pre> | </pre> | ||
Latest revision as of 19:08, 10 April 2025
This function determines whether a particular format of data is present in the clipboard, and if so, provides information about that format.
Syntax
WinQueryClipbrdFmtInfo(hab, fmt, prgfFmtInfo)
Parameters
- hab (HAB) - input
- Anchor-block handle.
- fmt (ULONG) - input
- Format of the data to be queried.
- 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:
Format Name Description CF_BITMAP Bit map. CF_DSPBITMAP Bit-map display format associated with private format. CF_DSPMETAFILE Metafile display format associated with private format. CF_DSPTEXT Text display format associated with private format. CF_METAFILE Metafile. 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.
- prgfFmtInfo (PULONG) - output
- Memory model and usage flags.
- These are the usage flags set by the setting application; that is, the CFI_* flags of the flFmtInfo parameter of the WinSetClipbrdData function.
- If the format is CF_BITMAP, CF_DSPBITMAP, CF_METAFILE or CF_DSPMETAFILE, prgfFmtInfo is set to CFI_HANDLE. If the format is CF_TEXT or CF_DSPTEXT, prgfFmtInfo is set to CFI_POINTER. If the format is user-defined, prgfFmtInfo is set to the value used in the WinSetClipbrdData function.
Returns
- rc (BOOL) - returns
- Format-exists indicator.
- TRUE - fmt exists in the clipboard and prgfFmtInfo is set
- FALSE - fmt does not exist in the clipboard and prgfFmtInfo is not set.
Remarks
This function does not cause the data to be rendered.
Applications can put information in the clipboard in their own private format. Use the following function calls to create and query a private format:
fDataPlaced = WinSetClipbrdData(hab, ulh, WinAddAtom(WinQuerySystemAtomTable(), "Private Data Type"), flFmtInfo); ulData = WinQueryClipbrdData(hab, WinFindAtom(WinQuerySystemAtomTable(), "Private Data Type"));
Example Code
This example obtains a handle to the current clipboard data of text format if that format is present in the clipboard.
#define INCL_WINCLIPBOARD #include <os2.h> HAB hab; ULONG format; ULONG hclipbrdData; if (WinQueryClipbrdData(hab,CF_TEXT)) { hclipbrdData = WinQueryClipbrdFmtInfo(hab, CF_TEXT, &format); }