WinQueryClipbrdData
Appearance
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);