WinFindAtom - Example Code

This example queries an Atom Table for the atom name of a newly created atom "newatom" and then verifies that the atom value returned by the query matches the atom value returned by WinAddAtom.

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

ATOM  atom;             /* new atom value                       */
ATOM  atomFound;        /* atom value from WinFindAtom          */
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)     */
BOOL atomMatch = FALSE; /* indicates atom values match          */

/* 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);

atomFound = WinFindAtom(hatomtblAtomTbl, pszAtomName);

/* verify that the atom values match */
if (atom == atomFound)
   atomMatch = TRUE;


[Back: WinFindAtom - Related Functions]
[Next: WinFindAtom - Topics]