WinDeleteAtom: Difference between revisions
Appearance
Created page with "This function deletes an atom from an atom table. ==Syntax== WinDeleteAtom(hatomtblAtomTbl, atom) ==Parameters== ;hatomtblAtomTbl (HATOMTBL) - input :Atom-table handle. :Th..." |
No edit summary |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
This function deletes an atom from an atom table. | This function deletes an atom from an atom table. | ||
==Syntax== | ==Syntax== | ||
WinDeleteAtom(hatomtblAtomTbl, atom) | WinDeleteAtom(hatomtblAtomTbl, atom) | ||
==Parameters== | ==Parameters== | ||
;hatomtblAtomTbl (HATOMTBL) - input | ;hatomtblAtomTbl (HATOMTBL) - input:Atom-table handle. | ||
:Atom-table handle. | :This is the handle returned from a previous [[WinCreateAtomTable]] or [[WinQuerySystemAtomTable]] function. | ||
:This is the handle returned from a previous WinCreateAtomTable or WinQuerySystemAtomTable function. | ;[[atom]] ([[ATOM]]) - input:Atom identifying the atom to be deleted. | ||
;atom (ATOM) - input | |||
:Atom identifying the atom to be deleted. | |||
==Returns== | ==Returns== | ||
;rc (ATOM) - returns | ;rc (ATOM) - returns:Return code. | ||
:Return code. | |||
:Call successful Other | :Call successful Other | ||
:The call fails and the atom has not been deleted, in which case this is equal to the atom parameter. | :The call fails and the atom has not been deleted, in which case this is equal to the atom parameter. | ||
Line 19: | Line 16: | ||
==Errors== | ==Errors== | ||
Possible returns from WinGetLastError | Possible returns from WinGetLastError | ||
;PMERR_INVALID_HATOMTBL (0x1013) | ;PMERR_INVALID_HATOMTBL (0x1013):An invalid atom-table handle was specified. | ||
:An invalid atom-table handle was specified. | ;PMERR_INVALID_ATOM (0x1014):The specified atom does not exist in the atom table. | ||
;PMERR_INVALID_ATOM (0x1014) | |||
:The specified atom does not exist in the atom table. | |||
==Remarks== | ==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. | 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== | ==Example Code== | ||
This example deletes a newly created atom in an Atom Table based on the atom value returned by WinAddAtom. | This example deletes a newly created atom in an Atom Table based on the atom value returned by WinAddAtom. | ||
<pre> | <pre> | ||
#define INCL_WINATOM /* Window Atom Functions */ | #define INCL_WINATOM /* Window Atom Functions */ | ||
Line 48: | Line 44: | ||
atomDelete = WinDeleteAtom(hatomtblAtomTbl, atom); | atomDelete = WinDeleteAtom(hatomtblAtomTbl, atom); | ||
</pre> | </pre> | ||
Definition | Definition | ||
<pre> | <pre> | ||
Line 62: | Line 57: | ||
==Related Functions== | ==Related Functions== | ||
* WinAddAtom | * [[WinAddAtom]] | ||
* WinCreateAtomTable | * [[WinCreateAtomTable]] | ||
[[Category:Win]] | [[Category:Win]] |
Latest revision as of 03:58, 6 April 2025
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);