Jump to content

WinEnumClipbrdFmts

From EDM2
Revision as of 22:37, 10 December 2023 by Martini (talk | contribs) (Created page with "This function enumerates the list of clipboard data formats available in the clipboard. ==Syntax== WinEnumClipbrdFmts(hab, fmt) ==Parameters== ;hab (HAB) - input :Anchor-b...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function enumerates the list of clipboard data formats available in the clipboard.

Syntax

WinEnumClipbrdFmts(hab, fmt)

Parameters

hab (HAB) - input
Anchor-block handle.
fmt (ULONG) - input
Previous clipboard-data format index.
Specifies the index of the last clipboard data format enumerated using this function.
This should start at zero, in which instance the first available format is obtained. Subsequently, it should be set to the last format index value returned by this function.


Returns

ulNext (ULONG) - returns
Next clipboard-data format index.
Possible values include:
Enumeration is complete
that is, there are no more clipboard formats available.
Other
Index of the next available clipboard-data format in the clipboard.

Remarks

The clipboard should be open before this function is used.

Example Code

This example enumerates and counts the available clipboard data formats for the clipboard opened by WinOpenClipbrd.

#define INCL_WINCLIPBOARD       /* Window Clipboard Functions   */
#include <os2.h>

BOOL  fSuccess;         /* success indicator                    */
HAB   hab;              /* anchor-block handle                  */
ULONG   ulNext;         /* next format index                    */
ULONG   ulPrev;         /* previous format index                */
ULONG   ulNumFormats=0; /* number of available formats          */


fSuccess = WinOpenClipbrd(hab);

if (fSuccess)
   {
   ulPrev = 0;
   /* enumerate formats and maintain count */
   while ((ulNext = WinEnumClipbrdFmts(hab, ulPrev)) != 0)
      {
      ulNumFormats++;
      ulPrev = ulNext;
      }
   }

Definition

#define INCL_WINCLIPBOARD /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HAB      hab;     /*  Anchor-block handle. */
ULONG    fmt;     /*  Previous clipboard-data format index. */
ULONG    ulNext;  /*  Next clipboard-data format index. */

ulNext = WinEnumClipbrdFmts(hab, fmt);

Related Functions