This example assumes that the two processes described in the previous example require only to pass character strings, perhaps containing the request and the returned information. In this case, the requester obtains the handle to the system atom table using the WinQuerySystemAtomTable() function. It may then add the request string to this table using the WinAddAtom() function, and obtain an atom that represents the string in the table. This atom may then be passed to the server process in an application-defined Presentation Manager message. An example of this technique is shown in Figure "Interprocess Communication Using Atoms (Part 1)".
When the server process receives this message, it may also obtain the handle to the system atom table, and retrieve the string using the atom supplied in the message. If the string is of a predefined length, the server may simply retrieve the string using the WinQueryAtomName() function. If the string is of variable length, the server may need to obtain the length of the string using the WinQueryAtomLength() function, and allocate a buffer for the string. This is illustrated in Figure "Interprocess Communication Using Atoms (Part 2)".
The server may return information to the requester using the system atom table. The WinAddAtom() function is used by the server to add the result string to the atom table, and the WinQueryAtomLength() and WinQueryAtomName() functions are used by the requester to retrieve the string. In the example shown in Figure "Interprocess Communication Using Atoms (Part 1)", it is assumed that the reply string returned to the requester is of a predefined length, and the WinQueryAtomLength() function is thus not required.
Note that the request string is not removed from the atom table until the server process has returned the result to the requester. Once the result is obtained and verified, the requester removes both the request and the result using the WinDeleteAtom() function.
The functions used to manipulate atoms and atom tables are described in detail in the IBM OS/2 Version 2.0 Presentation Manager Reference.