{ Add the following declaration to your main form's public declaration section }
RealCmdShow: word;
{ Add the following code to your main form's OnCreate event handler }
procedure TForm1.FormCreate(Sender: TObject);
var
SUI: TStartupInfo;
begin
if CmdShow = SW_SHOWDEFAULT then begin
GetStartupInfo(SUI);
RealCmdShow := SUI.wShowWindow;
end else
RealCmdShow := CmdShow ;
if RealCmdShow = SW_SHOWMAXIMIZED then
WindowState := wsMaximized;
end;
{ Add the following code to your main form's OnActivate event handler }
procedure TForm1.FormActivate(Sender: TObject);
begin
case RealCmdShow of
SW_SHOWMINIMIZED,
SW_MINIMIZE,
SW_SHOWMINNOACTIVE:
Application.Minimize;
end;
end;
|