How can I hide a MDIChild window in Delphi?
I’m using this code in FormClose() event of my MDI children, but it doesn’t seem to work:
procedure TfrmInstrument.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caNone;
ShowWindow(Handle, SW_HIDE);
frmMainForm.MDIChildClosed(Handle);
end;
My child window is minimized instead of being hidden.
There is a protected procedure in
TCustomFormdefined as:Override it in your MDI child windows as:
Here’s a simple example
After reading Jeroen’s comment, I tried another solution which works as well, but with a little flickering:
Maybe this works on all Windows versions.
PS: I didn’t find any problem with the first solution on Windows 2k3SP2 x86 and Windows 7 Ultimate x86