AddAtom

  ATOM AddAtom(lpszName)    
  LPCTSTR lpszName; /* address of string to add */

The AddAtom function adds a character string to the local atom table and returns a unique value identifying the string.

Parameters

lpszName

Points to the null-terminated character string to be added to the table.

Return Value

The return value specifies the newly created atom if the function is successful. Otherwise, it is zero.

Comments

The AddAtom function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).

The AddAtom function stores no more than one copy of a given string in the atom table. If the string is already in the table, the function returns the existing atom value and increases the string's reference count by one.

The MAKEINTATOM macro can be used to convert a WORD value into a string that can be added to the atom table by using the AddAtom function.

The atom values returned by AddAtom are in the range 0xC000 through 0xFFFF.

Atoms are case-insensitive.

If AddAtom is passed a string of the form “#1234” then it will return the atom value that is the 16-bit representation of the decimal number specified in the string (e.g. 0x04D2 in this case). If the decimal value specified is 0x0000 or 0xC000 through 0xFFFF then this function will return NULL to indicate an error. If the pointer to the string is within the range 0x0001 through 0xBFFF then this function will return the low order portion of the pointer as the atom value.

See Also

DeleteAtom, FindAtom, GetAtomName