Jump to content

wpclsEnumClipboardClasses

From EDM2

This class method enumerates through all the object classes that a particular rendering mechanism supports.

Syntax

_wpclsEnumClipboardClasses(somSelf, aCBFormat, aPrevious)

Parameters

somSelf (M_WPDataFile *) - input
Pointer to the WPDataFile class object.
aCBFormat (ULONG) - input
Atom referring to the clipboard format.
aPrevious (ULONG) - input
The last atom passed in or 0 to start from the beginning.

Returns

rv (ULONG) - returns
An atom referring to a class name, or 0 if finished.

Remarks

If the second parameter is zero, this method returns the first atom in the list. Otherwise, it returns the next class name after the one passed in. If the atom passed in is the last atom in the list, the method will return 0.

The class names are returned and passed as atoms. Use WinQueryAtomName to get the real name from the atom.

How to Override

This method is not generally overridden.

Usage

This method can be called in a loop to enumerate all of the object classes that can process a specified clipboard format.

Example Code

Declaration.

#define INCL_WINWORKPLACE
#include <os2.png>

M_WPDataFile     *somSelf;    /* Pointer to the WPDataFile class object. */
ULONG             aCBFormat;  /* Atom referring to the clipboard format. */
ULONG             aPrevious;  /* The last atom passed in or 0 to start from the beginning. */
ULONG             rv;         /* An atom referring to a class name, or 0 if finished. */

rv = _wpclsEnumClipboardClasses(somSelf, aCBFormat, aPrevious);

This example enumerates all of the object classes that process the "MyFormat" clipboard format.

HATOMTBL   hAtomTable = NULLHANDLE;
ATOM       aFormat = 0, aClass = 0;
CHAR       szClassName[CCHMAXSTRING];

/* Find the system atom table */
hAtomTable = WinQuerySystemAtomTable();
if (hAtomTable)
{
   /* Add an atom to the system atom table for the clipboard format */
   aFormat = WinAddAtom(hAtomTable, "MyFormat");
   if (aFormat)
   {
      /* Enumerate the object classes that process the specified
       * clipboard format */
      aClass = _wpclsEnumClipboardClasses(aFormat, (ATOM)0);
      while (aClass)
      {
         if (WinQueryAtomName(hAtomTable,
                              aFormat,
                              szClassName,
                              sizeof(szClassName)))
         {
            /***** Process the class whose name was returned in szClassName *****/
         }
         aClass = _wpclsEnumClipboardClasses(aFormat, aClass);
      }

      /* Delete the atom from the system atom table */
      WinDeleteAtom(hAtomTable, aFormat);
   }
}

Related Methods