Viewer displays embedded windows within topic windows. To Viewer, an embedded window is a child window of that topic window.
Viewer creates embedded windows with window style WS_CHILD and a default size. It initializes the DLL for an embedded window before it displays the window.
When Viewer creates the embedded window, it passes two strings in the WM_CREATE message. The lparam parameter points to a CREATESTRUCT structure, and the lpCreateParams field of the CREATESTRUCT structure points to a second structure defined as follows in the DLL.H header file:
struct
{
short idMajVersion;
short idMinVersion;
LPSTR szFileName;
LPSTR szAuthorData;
HANDLE hfs;
DWORD coForeGround;
DWORD coBackGround;
}
The fields in the structure are defined in the following table:
Field | Use |
idMajVersion idMinVersion | Identifies the version of Viewer (and the version of the CREATESTRUCT structure used for embedded windows in that version of Viewer). Currently, these fields are 0. If the idMinVersion field is a value other than 0, additional interfaces may be available to DLLs, but all the interfaces described in this chapter are still supported. |
szFileName | Points to the fully-qualified name of the .MVB file containing the embedded window. |
szAuthorData | Points to the author-data parameter in the ewl, ewc, or ewr command from the source RTF file. |
hfs | Specifies a handle to the file system for the .MVB file. |
CoForeground CoBackground | Specify the foreground and background colors of the main Viewer window. |
The DLL should always verify that the value in the idMajVersion and idMinVersion fields of the CREATESTRUCT structure are 0. If they are not, the DLL might not work with that version of the Viewer. If the DLL uses the strings contained in the szFileName and szAuthorData fields, it should make copies of those strings. If the embedded window uses the same colors as the main Viewer window, the DLL can use the color values in the coForeground and coBackground fields to set those colors in the embedded window.
As an embedded-window DLL processes a WM_CREATE message, it is expected to set up any window styles the window uses and resize the window appropriately.
While a topic is being displayed, Viewer creates embedded windows when it needs to lay them out and destroys them when they are no longer needed. The window can be created and destroyed, then created again if necessary, while Viewer tries to lay out the embedded-window object. If you load information, you might want to do so during WM_SHOWWINDOW processing so that you don't have to load this information twice.
An embedded window may exist while it is not being displayed (for example, if it is not in the currently displayed part of a topic and the topic must be scrolled to display the window). Do not set the window style to WS_VISIBLE or call the ShowWindow function during WM_CREATE processing. Viewer displays the window when necessary.
Viewer expects the window size to remain fixed during the window's lifetime. Viewer positions the window using the justification (left, right, or character) authored into the RTF file.