Pregunta

String Atoms are useful in DDE(Dynamic Data Exchange). What is the use of Integer Atoms?

¿Fue útil?

Solución

The only use I know of are the atom numbers for built-in dialog class names. MessageBox, and others, use #32770. Which is what you use to find the window back. There are some others, I happily forgot their numbers and usage. This goes back to the 1980s, the days of 16-bit Windows and extreme resource limitations.

You can see sample code that uses this atom number in this answer.

    // Checks if <hWnd> is a dialog
    StringBuilder sb = new StringBuilder(260);
    GetClassName(hWnd, sb, sb.Capacity);
    if (sb.ToString() != "#32770") return true;

[EDIT]
Added some integer atom classes:

#ifndef POPUPMENU_CLASS_NAME
#define POPUPMENU_CLASS_NAME "#32768"  /* PopupMenu */
#endif
#ifndef DESKTOP_CLASS_NAME
#define DESKTOP_CLASS_NAME   "#32769"  /* Desktop */
#endif
#ifndef DIALOG_CLASS_NAME
#define DIALOG_CLASS_NAME    "#32770"  /* Dialog */
#endif
#ifndef WINSWITCH_CLASS_NAME
#define WINSWITCH_CLASS_NAME "#32771"  /* WinSwitch */
#endif
#ifndef ICONTITLE_CLASS_NAME
#define ICONTITLE_CLASS_NAME "#32772"  /* IconTitle */
#endif

Otros consejos

Using integer and string atoms is similar, but integer atoms do NOT have a reference count, so they are actually never stored in the atom table, but mapped directly to the atom value instead.

Example of String Atoms: Windows class names (but they also may use Integer Atom, see Hans Passant's answer)

Example of Integer Atoms: Standard clipboard formats

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top