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:
EWM_RENDER (0x706A)
EWM_QUERYSIZE (0x706B)
EWM_ASKPALETTE (0x706C)
Viewer 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 on 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. The Viewer frees this handle. |
CF_BITMAP | Handle to a bitmap. The Viewer removes this handle. |
Viewer 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.
Viewer 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. Viewer 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)