MSDN -> Window Features -> Message-Only Windows:
> A message-only window enables you to send and receive messages. It is not visible, has no z-order, cannot be enumerated, and does not receive broadcast messages. The window simply dispatches messages.
> To create a message-only window, specify the HWND_MESSAGE constant or a handle to an existing message-only window in the hWndParent parameter of the CreateWindowEx function. You can also change an existing window to a message-only window by specifying HWND_MESSAGE in the hWndNewParent parameter of the SetParent function.
> To find message-only windows, specify HWND_MESSAGE in the hwndParent parameter of the FindWindowEx function. In addition, FindWindowEx searches message-only windows as well as top-level windows if both the hwndParent and hwndChildAfter parameters are NULL.
1) "cannot be enumerated"
Да могут !
"Обычные" окна образуют иерархию с вершиной DesktopWindow, а EnumChildWindows(DesktopWindow) перечисляет все "обычные" окна.
Но и message-only окна образуют иерархию, вот процедурка для получения вершинного "MessageWindow" (назовем его так):
GetMessageWindow = GetAncestor(FindWindowEx(HWND_MESSAGE,0,0,0),GA_PARENT)
О классе полученного окна — "Message" — в MSDN аж целая строчка:
> Message Windows 2000/Windows XP: The class for a message-only window.
Это строчка из таблицы, которая "describes the system classes that are available only for use by the system" (MSDN -> About Window Classes -> System Classes).
Таблица, кстати, неполная...
Так вот, оказывается —
EnumChildWindows(MessageWindow) enumerates all message-only windows !
См. исходники утилиток
WinTreeSnap,
FrameRector.
2) "To create a message-only window, specify the HWND_MESSAGE constant or a handle to an existing message-only window in the hWndParent parameter of the CreateWindowEx function.
Но это верно только для вершинного MessageWindow !
А любой другой message-only owner приведет к созданию "обычного", а не message-only окна.
3) "You can also change an existing window to a message-only window by specifying HWND_MESSAGE in the hWndNewParent parameter of the SetParent function."
А вот тут не только HWND_MESSAGE или MessageWindow, но и любое message-only сгодится.
Т.е. MSDN-овские разъяснения о hWndParent и hWndNewParent надо бы поменять местами
Поскольку
предположениеАвтор: kero
Дата: 08.10.08
— подтвердилось, добавляю еще один занятный факт:
На Win OS >=2k при создании любого окна система назначает ему временным, первоначальным парентом то самое вершинное "MessageWindow" (см.выше), т.е. любое окно первоначально — message-only !
Наблюдаем в момент HCBT_CREATEWND:
hcbt_monitor.zip