Jump to content

WinDeleteAtom

From EDM2
Revision as of 02:38, 16 May 2023 by Martini (talk | contribs) (Created page with "This function deletes an atom from an atom table. ==Syntax== WinDeleteAtom(hatomtblAtomTbl, atom) ==Parameters== ;hatomtblAtomTbl (HATOMTBL) - input :Atom-table handle. :Th...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function deletes an atom from an atom table.

Syntax

WinDeleteAtom(hatomtblAtomTbl, atom)

Parameters

hatomtblAtomTbl (HATOMTBL) - input
Atom-table handle.
This is the handle returned from a previous WinCreateAtomTable or WinQuerySystemAtomTable function.
atom (ATOM) - input
Atom identifying the atom to be deleted.

Returns

rc (ATOM) - returns
Return code.
Call successful Other
The call fails and the atom has not been deleted, in which case this is equal to the atom parameter.

Errors

Possible returns from WinGetLastError

PMERR_INVALID_HATOMTBL (0x1013)
An invalid atom-table handle was specified.
PMERR_INVALID_ATOM (0x1014)
The specified atom does not exist in the atom table.

Remarks

If the passed atom is an integer atom, 0 is returned. If it is not an integer atom and it is a valid atom for the given atom table, that is, it has an atom name and use count, its use count is decremented by one and 0 is returned. If the use count has been decremented to zero, the atom name and use count are removed from the atom table.

Example Code

This example deletes a newly created atom in an Atom Table based on the atom value returned by WinAddAtom.

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

ATOM  atom;             /* new atom value                       */
ATOM  atomDelete;       /* result of atom delete                */
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)     */

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

atomDelete = WinDeleteAtom(hatomtblAtomTbl, atom);

Definition

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

HATOMTBL    hatomtblAtomTbl;  /*  Atom-table handle. */
ATOM        atom;             /*  Atom identifying the atom to be deleted. */
ATOM        rc;               /*  Return code. */

rc = WinDeleteAtom(hatomtblAtomTbl, atom);

Related Functions

  • WinAddAtom
  • WinCreateAtomTable
  • WinDestroyAtomTable
  • WinFindAtom
  • WinQueryAtomLength
  • WinQueryAtomName
  • WinQueryAtomUsage
  • WinQuerySystemAtomTable