The program have main form and a N-number of other forms that are created as modal from main form.
Workers are using 2 or 3 monitors(screens) simultaneously, so they doesnt want to see deactivated main form if modal form is placed on another screen.
I added ExStyle=WS_EX_APPWINDOW to all modal forms and hide main form when new modal is created
ActiveModalForm:=TComponentClass(AClass).Create(Application) as TCustomForm;
Hide(); //hides main form
ActiveModalForm.ShowModal; //show new modal window
FreeAndNil(ActiveModalForm); // destroy modal window
Show(); //shows main form
Modal form CreateParams:
procedure TfrmNewModal.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
with Params do
begin
WndParent := 0;
ExStyle := ExStyle OR WS_EX_APPWINDOW;
end;
end;
The problem is that if user want to minimize that modal form it will minimize and show again.
I'm trying to minimize it by this way:
procedure TfrmNewModal.WMSysCommand(var Msg: TWMSysCommand);
begin
case (msg.cmdtype and $FFF0) of
SC_MINIMIZE:
ShowWindow( handle, SW_MINIMIZE );
SC_RESTORE:
ShowWindow( handle, SW_RESTORE )
else
inherited;
end;
end;
I think that the problem is in WS_EX_APPWINDOW, but i cant imagine at the current moment another way how i can show modal window on task bar and minimize it.
Can anybody help?
Thank You.