This example creates an Atom Table and then adds the atom "newatom" to the new table; it then checks the count for this new atom to verify that it is 1.

#define INCL_WINATOM            /* Window Atom Functions        */
#include <os2.h>

ATOM  atom;             /* new atom value                       */
HATOMTBL  hatomtblAtomTbl; /* atom-table handle                 */
char   pszAtomName[10]; /* atom name                            */
ULONG   ulInitial = 0;  /* initial atom table size (use default)*/
ULONG   ulBuckets = 0;  /* size of hash table (use default)     */
ULONG   ulCount;        /* atom usage count                     */
BOOL atomCount1 = FALSE;/* indicates atom count != 1            */

/* create atom table of default size */
hatomtblAtomTbl = WinCreateAtomTable(ulInitial, ulBuckets);

/* define name for new atom and add to table */
strcpy(pszAtomName,"newatom");
atom = WinAddAtom(hatomtblAtomTbl, pszAtomName);

ulCount = WinQueryAtomUsage(hatomtblAtomTbl, atom);

/* verify that usage count is 1 */
if (ulCount == 1)
   atomCount1 = TRUE;


[Back] [Next]