An application creates an atom by calling WinAddAtom, passing an atom-table handle and a pointer to a string. The system searches the specified atom table for the string. If the string already resides in the atom table, the system increments the usage count for the string and returns the corresponding atom to the application. Repeated calls to add the same atom string return the same atom. If the atom string does not exist in the table when WinAddAtom is called, the string is added to the table, its usage count is set to 1, and a new atom is returned.

An application can retrieve the usage count associated with a given atom using WinQueryAtomUsage. By obtaining the usage count, an application can detect whether other applications, or other threads within the application, are using the same atom.


[Back] [Next]