Embedded windows receive most standard Windows messages, including mouse and WM_PAINT messages. Embedded windows should not take the input focus; therefore, they do not need to process keystrokes.
Embedded window DLLs must also process the following messages, which are specifically defined for use with embedded windows:
nEWM_RENDER (0x706A)
nEWM_QUERYSIZE (0x706B)
nEWM_ASKPALETTE (0x706C)
Windows Help sends the EWM_RENDER message to an embedded window to get information about the image in the window. It uses this information when printing the image or placing it in the Clipboard. The wParam parameter to EWM_RENDER indicates the type of information returned by the message, and the LOWORD of the return value contains a handle to this information. Possible wParam values and return values are shown in the following table.
wParam | Return Value |
CF_TEXT | Sharable global handle to a null-terminated ASCII string. Windows Help frees this handle. |
CF_BITMAP | Handle to a bitmap. Windows Help removes this handle. |
Windows Help sends the EWM_QUERYSIZE message to an embedded window to obtain the size of the window. The wParam parameter is a handle to the device context for the window. The lParam parameter points to a POINT structure. The embedded window DLL should fill in the x field of the structure with the window’s height and the y field of the structure with the window’s width. Windows Help uses this information when laying out the topic in the topic window, when printing the topic, or when placing it in the Clipboard.
Windows Help sends the EWM_ASKPALETTE message to all embedded windows displayed within a topic to get information about the palettes used in each window. The wParam and lParam parameters are not used.
When an embedded window receives an EWM_ASKPALETTE message, it should return a handle to the palette that it uses. Windows Help then selects the most appropriate palette for use in that topic. Usually, this palette is the one used for the first embedded window in the currently displayed part of the topic.
Before the DLL repaints an embedded window, it should send an EWM_ASKPALETTE message to the parent window to determine which palette to use. The following code fragment illustrates how to do this:
hpal = (HPALETTE)SendMessage(GetParent(hwnd), EWM_ASKPALETTE, 0, 0L)