ID: Q99799
The information in this article applies to:
In a standard Microsoft Windows version 3.1 multiple document interface (MDI) application, when a minimized MDI child is active and the user presses the ENTER key, the child is not restored.
This is inconsistent with other MDI applications, such as File Manager and Program Manager. An MDI child in one of these applications is restored when it is the active MDI child and the ENTER key is pressed. When a normal Windows-based application is minimized and the user presses ENTER, that application is restored to a normal state.
One quick workaround to this problem is to create an accelerator for the ENTER key and restore the minimized MDI child when the key is pressed.
It may be desirable to implement the same restore feature that File Manager and Program Manager have implemented in order to enable the user to restore an MDI child by pressing the ENTER key. If this feature is implemented, then the MDI application can be consistent with other popular applications such as File Manager, Microsoft Excel, and Microsoft Word.
To achieve this effect in an MDI application, create an accelerator in the accelerator table of the resource file for the application. This can be done as follows:
MdiAccelTable ACCELERATORS
{
. . .
. . .
VK_RETURN, IDM_RESTORE, VIRTKEY
}
After this accelerator has been installed in the MDI application, each
time the ENTER key is pressed by the user, an IDM_RESTORE command will
be sent to the MDI frame window's window procedure through a
WM_COMMAND message. When the MDI frame receieves this message, its
window procedure should retrieve a handle to the active MDI child and
determine if it is minimized. If it is minimized, then it can restore
the MDI child by sending the MDI client a WM_MDIRESTORE message. This
can all be done with the following code:
case IDM_RESTORE:
{
HWND hwndActive;
hwndActive = SendMessage(hwndClient,WM_MDIGETACTIVE,0,0L);
if (IsIconic(hwndActive))
SendMessage(hwndClient,WM_MDIRESTORE,hwndActive,0L);
break;
}
Additional query words:
Keywords : kbMDI kbNTOS kbGrpUser kbWinOS kbWndw
Issue type : kbprb
Last Reviewed: December 26, 1998