private
procedure WMSysCommand(var Msg:TMessage);message WM_SYSCOMMAND;
procedure TFormMain.WMSysCommand(var Msg: TMessage);
begin
case Msg.WParam of
SC_CLOSE,SC_MINIMIZE,SC_MAXIMIZE:
begin
Application.Minimize;
end;
else inherited;
end;
end;