This is a set of APIS for storing strings.
Store a string through addatom and return an ID;
Getatomname uses this ID to return the stored string;
You can also use findatom to find and delete stored strings with deleteatom.
This storage area is divided into local (ProgramLevel) and Global (system level), with the global prefix is global [but in Win32 whether they are different yet to be studied].
The strings in the table are case-insensitive. If the names are repeated, an ID reference will be added, but the first string will be used.
// Declaration: addatom (lpstring: pchar {string pointer}): atom; {return string ID} deleteatom (natom: Atom {string ID }): atom; {return string ID; Failure return 0} findatom (lpstring: pchar {string pointer}): atom; {return string ID; Failure return 0} getatomname (natom: atom; {string ID} lpbuffer: pchar; {buffer} nsize: INTEGER {buffer size}): uint; {returns the actual length of the string; returns 0 if a failure} globaladdatom (lpstring: pchar {string pointer}): atom; {returned string ID} globaldeleteatom (natom: Atom {string ID}): atom; {returned string ID; failed returned 0} globalfindatom (lpstring: pchar {string pointer}): atom; {returns string ID; returns 0 if a failure} globalgetatomname (natom: atom; {string ID} lpbuffer: pchar; {buffer} nsize: INTEGER {buffer size}): uint; {returns the actual length of the string; returns 0 if failed}
// For example: var N1, N2: atom; PS: array [0 .. 254] of char; begin N1: = addatom ('delphi blog in case '); N2: = addatom ('delphi blog in case'); getatomname (N1, PS, 255); showmessage (PS); {in case of Delphi blog} getatomname (N2, PS, 255); showmessage (PS); {in case of Delphi blog} end;