LPCSTR MAKEINTATOM(wInteger) | |||||
WORD wInteger; | /* integer to make into atom | */ |
The MAKEINTATOM macro creates an integer atom that represents a character string of decimal digits.
Integer atoms created by this macro can be added to the atom table using the AddAtom function.
wInteger
Specifies the numeric value to be made into an integer atom.
The return value is a pointer to the atom created for the given integer.
Although the return value of the MAKEINTATOM macro is cast as an LPCSTR, the return value cannot be used as a string pointer, except when it is passed to atom-management functions that require an LPCSTR parameter.
The DeleteAtom function always succeeds for integer atoms, even though it does nothing. The string returned by the GetAtomName function for an integer atom will be a null-terminated string where the first character is a pound sign (#) and the remaining characters are the word used in the MAKEINTATOM macro.
The MAKEINTATOM macro is defined in WINDOWS.H as follows:
#define MAKEINTATOM(i) ((LPCSTR)MAKELP(NULL, (i)))
The following example uses the MAKEINTATOM macro to convert the number 32,565 into an integer atom. The atom is then added to the local atom table by the AddAtom function:
ATOM at;
char szMsg[80];
LPCSTR lpszAtom;
lpszAtom = MAKEINTATOM(32565);
at = AddAtom(lpszAtom);
if (at == 0)
MessageBox(hwnd, "AddAtom failed", "", MB_ICONSTOP);
else {
sprintf(szMsg, "AddAtom returned %u", at);
MessageBox(hwnd, szMsg, "", MB_OK);
}