A set of APIS for storing strings

Source: Internet
Author: User

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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.