ATOM GlobalFindAtom(lpszString) | |||||
LPCSTR lpszString; | /* address of string to find | */ |
The GlobalFindAtom function searches the system atom table for the specified character string and retrieves the global atom associated with that string. (A global atom is an atom that is available to all Windows applications.)
lpszString
Points to the null-terminated character string to search for.
The return value identifies the global atom associated with the given string, if the function is successful. Otherwise, if the string is not in the table, the return value is zero.
The following example repeatedly calls the GlobalFindAtom function to retrieve the atom associated with the string “This is a global atom”. The example uses the GlobalDeleteAtom function to decrement (decrease by one) the reference count for the atom until the atom is deleted and GlobalFindAtom returns zero.
int cRef;
ATOM atom;
char szMsg[80];
for (cRef = 0; ((atom = GlobalFindAtom("This is a global atom")) != 0);
cRef++)
GlobalDeleteAtom(atom);
wsprintf(szMsg, "reference count was %d", cRef);
MessageBox(hwnd, szMsg, "GlobalDeleteAtom", MB_OK);