Try:
void __fastcall TForm::FormActivate(TObject *Sender)
{
WindowState |= (TWindowState)wsMaximized;
and if You want to disable or avoid minimize-maximize button
in header :
virtual void __fastcall WndProc(TMessage &Msg);
in source:
void __fastcall TForm::WndProc(TMessage &Msg)
{
HMENU hSystemMenu; // the MDI child's system menu
// This sample MDI child window procedure can be used to prevent the
// MDI child from being maximized, minimized, or sized.
//
// Note that the child will still have a maximize button, a minimize
// button, and a thick "sizing" border. Currently, there is no way to
// prevent Windows from creating MDI children with these default
// styles.
//
// We can, however, disable the maximizing, minimizing, and sizing
// functionality by:
//
// 1. Disabling system menu options
// 2. Trapping WM_SYSCOMMAND messages
switch(Msg.Msg)
{
case WM_INITMENU:
// Disable and gray the Maximize, Minimize, and Size items
// on the MDI child's system menu
hSystemMenu = GetSystemMenu(Handle, FALSE);
EnableMenuItem(hSystemMenu, SC_MAXIMIZE, MF_DISABLED |
MF_BYCOMMAND);
EnableMenuItem(hSystemMenu, SC_MINIMIZE, MF_DISABLED |
MF_BYCOMMAND);
EnableMenuItem(hSystemMenu, SC_RESTORE, MF_DISABLED |
MF_BYCOMMAND);
EnableMenuItem(hSystemMenu, SC_SIZE, MF_DISABLED | MF_BYCOMMAND);
Return or break; // i'm not sure !!!
case WM_SYSCOMMAND:
// "Eat" these system commands to disable maximizing,
// minimizing, and sizing functionality.
// Note that wParam must be combined with 0xFFF0, using
// the C bitwise AND (&) operator, when processing
// the WM_SYSCOMMAND message.
switch (Msg.WParam)
{
case SC_MAXIMIZE:
case SC_MINIMIZE:
case SC_SIZE:
case SC_RESTORE:
Msg.Result = 0L;
return;
}
}
TForm::WndProc(Msg);
Martin Lachance ha scritto nel messaggio
<86ii6o$n3...@bornews.borland.com>...
Quote
>I have a maximised MDI child in an application, and when I open a second
MDI
>child, the first one is restored to its original state... I would like the
>first child to be maximised, while the second one is on top of it. Is it
>possible?