With the help of the globaladdatom API function, you can transmit a string through windows information. This function returns a number that can be used by wparam or lparam in postmessage (or sendmessage.
Sender:
Wparam = globaladdatom ('string ...')
Postmessage (hwnd, wm_xyz, wparam, 0)
Receiver:
STR = globalgetatomname (wparam)
Globaldeleteatom (wparam)
The following describes globaldeleteatom.
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 zone is divided into two types: Local (program level) and Global (system level). The Global prefix is global [but whether they are different in Win32 remains 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; {returns the string ID; returns 0 if a failure occurs}Findatom (lpstring: pchar {string pointer}): Atom; {returns the string ID; returns 0 if a failure occurs}Getatomname (natom: atom; {string ID}Lpbuffer: pchar; {buffer}Nsize: INTEGER {buffer size}): Uint; {returns the actual length of the string; returns 0 if the string fails to be returned}Globaladdatom (lpstring: pchar {string pointer}): Atom; {return string ID}Globaldeleteatom (natom: Atom {string ID}): Atom; {returns the string ID; returns 0 if a failure occurs}Globalfindatom (lpstring: pchar {string pointer}): Atom; {returns the string ID; returns 0 if a failure occurs}Globalgetatomname (natom: atom; {string ID}Lpbuffer: pchar; {buffer}Nsize: INTEGER {buffer size}): Uint; {returns the actual length of the string; returns 0 if the string fails to be returned}
// Example:VaRN1, N2: atom; PS:Array[0.. 254]OfChar;BeginN1: = addatom ('in case of Delphi blog'); N2: = addatom ('in case of Delphi blog'(); Getatomname (N1, PS, 255)); Showmessage (PS); {in case of a Delphi blog}Getatomname (N2, PS, 255); Showmessage (PS); {in case of a Delphi blog}End;