1. Modify the onclose message function of the subwindow as follows:Code:
Void cchildframe: onclose ()
{
// When you press Ctrl + F4, the window will not be closed.
// Cmdichildwnd: onclose ();
}
2. Add the oncreate message function of the subwindow and change it to the following code:
Int cchildframe: oncreate (maid)
{
If (cmdichildwnd: oncreate (lpcreatestruct) =-1)
Return-1;
Cmenu * pmenu = getsystemmenu (false );
If (pmenu)
{
Pmenu-> enablemenuitem (SC _close, mf_bycommand | mf_grayed );
}
Return 0;
}
// ---------- Display mode of multiple views in MDI
Void cmainframe: onaa ()
{
// Add the following line of code under cmdiframewnd
Mditile (mditile_horizontal );
}
Void mditile (INT ntype );
Parameter: ntype specifies the tile flag. This parameter can only be one of the following values:
· Mditile_horizontal tiled MDI subwindow so that one window can appear on the other.
· Mditile_skipdisabled prevents invalid MDI subwindows from being tiled.
· Mditile_vertical tiled MDI subwindow so that one window can appear next to the other.
Mditile (mditile_horizontal );