DeleteAtom

2.x

  ATOM DeleteAtom(atm)    
  ATOM atm; /* atom to delete, */  

The DeleteAtom function decrements (decreases by one) the reference count of a local atom by one. If the atom's reference count is reduced to zero, the string associated with the atom is removed from the local atom table.

An atom's reference count specifies the number of times the atom has been added to the atom table. The AddAtom function increments (increases by one) the count on each call. DeleteAtom decrements the count on each call and removes the string only if the atom's reference count is reduced to zero.

Parameters

atm

Identifies the atom and character string to be deleted.

Return Value

The return value is zero if the function is successful. Otherwise, it is equal to the atm parameter.

Comments

The only way to ensure that an atom has been deleted from the atom table is to call this function repeatedly until it fails. When the count is decremented to zero, the next call to the FindAtom or DeleteAtom function will fail.

DeleteAtom has no effect on integer atoms (atoms created by using the MAKEINTATOM macro). The function always returns zero for integer atoms.

Example

The following example uses the DeleteAtom function to decrement the reference count for the specified atom:

ATOM at;

at = DeleteAtom(atTest);

if (at == NULL)
    MessageBox(hwnd, "atom count decremented",
        "DeleteAtom", MB_OK);
else
    MessageBox(hwnd, "atom count could not be decremented",
        "DeleteAtom", MB_ICONEXCLAMATION);

See Also

AddAtom, FindAtom, GlobalDeleteAtom