Jump to content

WinQueryClipbrdFmtInfo

From EDM2
Revision as of 22:54, 10 December 2023 by Martini (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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:
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 = WinQueryClipbrdFmfInfo(hab,
                                          CF_TEXT
                                          &format);
   }


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 queried. */
PULONG    prgfFmtInfo;  /*  Memory model and usage flags. */
BOOL      rc;           /*  Format-exists indicator. */

rc = WinQueryClipbrdFmtInfo(hab, fmt, prgfFmtInfo);

Related Functions