SAMPLE: Code Implementing a Child Window with MenusLast reviewed: February 15, 1996Article ID: Q93199 |
The information in this article applies to:
SUMMARYChild windows by design do not have menus; however, some applications may require such child windows. CHILDMNU demonstrates one way to embed a pop-up window with menus in a child window to simulate a child window with menus. Download CHILDMNU.EXE from the Microsoft Software Library (MSL) on the following services:
MORE INFORMATIONChild windows were not designed to have menus but under certain circumstances an application may require a child window with menus. Below are the steps to simulate a child window with menus:
Other ConsiderationsMaximizing: When a child window is maximized, it uses the screen's maximum size. To have the child window act similar to an MDI child, two messages need to be processed; WM_SIZE in the main parent's window procedure and WM_GETMINMAXINFO in the child's window procedure. WM_SIZE of the child's parent window procedure checks for SIZE_MAXIMIZE and SIZE_RESTORE. Then, if the child window is maximized, call ShowWindow() with SW_MAXIMIZED. This method adjusts the child window's size to the new size of the parent's client area. On WM_GETMINMAXINFO of the child's window procedure, calculate the size of the parent's client area. Use the newly calculated size and set the ptMaxSize variable of the MINMAXINFO structure. This ensures that the child is always fully contained within its parent client area when maximized.
|
Additional reference words: 3.10 softlib CHILDMNU.EXE
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |