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; } }