windowsdelphitaskbar

When I hide the Main Form and show another Form (like a splash screen, login, or secondary UI), the app disappears from the Taskbar


I am currently learning the fundamentals of Delphi.

When I hide the Main Form and show/display a new Form, the icon of the program on the Taskbar disappears.

 FRMsecond.show;
 Frmmain.hide;

The .dpr for my program looks like this:

begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TFRMlogin, FRMlogin);
  Application.CreateForm(TFRMstatistics, FRMstatistics);
  Application.CreateForm(TFRMregister, FRMregister);
  Application.Run;
end.

Solution

  • setting the Application.MainFormOnTaskbar to False will indeed work, But (I forgot to mention, my bad) I am experimenting with a very old Delphi language and thus setting the Application.MainFormOnTaskbar to False won't work. I instead found a workaround (created a tiny procedure):

    procedure TFRMlogin.FRMshow(Form: TForm);  
    begin  
    SetWindowLong (Form.Handle, GWL_EXSTYLE,GetWindowLong (Form.Handle, GWL_EXSTYLE) or WS_EX_APPWINDOW) ;  
    end;