Jump to content
Mike Torrettinni

Splash screen doesn't show icon in taskbar

Recommended Posts

I have a simple splash screen and I kind of think it should have an icon in taskbar, before Main form is shown. Right?

 

I just tested a simple example with new project and new form, and icon is not displayed - as you can see the splash screen form does open in taskbar, but without an icon.

 

image.png.c7f0e2a7ba08e53ae2ee243d9afc0164.png

 

When main form is shown, the icon is there:

 

image.png.14c494350b3d99d93400c759a82bd0b7.png

 

So, fresh new project with empty Form1 and empty Form 5. I can add source, but really only Project.dpr is changed, all the rest are empty forms.

Here is project source:

 

program Project1;

uses
  Vcl.Forms,
  System.SysUtils,
  Unit1 in 'Unit1.pas' {Form1},
  Unit5 in 'Unit5.pas' {Form5};

{$R *.res}

begin

  Form5 := TForm5.Create(nil);
  Form5.Show;

  Application.Initialize;
  Application.CreateForm(TForm1, Form1);

  sleep(5000);

  Form5.Free;

  Application.Run;
end.

 

Is that normal for splash form to not show icon in taskbar? Any suggestions to fix this?

 

  • Like 1

Share this post


Link to post

What Delphi version are you using? In older versions the Application object was actually the one owning the taskbar button, all other forms used the (zero-size) window maintained by the Application object as API-level owner, and Window does not show taskbar buttons for owned windows.

Share this post


Link to post
22 minutes ago, PeterBelow said:

What Delphi version are you using? In older versions the Application object was actually the one owning the taskbar button, all other forms used the (zero-size) window maintained by the Application object as API-level owner, and Window does not show taskbar buttons for owned windows.

 I use Delphi 10.2 update 3. Does this apply to my version?

Share this post


Link to post

I tried this suggestion for Delphi 7, and it still works in Rio and Windows 7. In TForm5:

  protected
    procedure CreateParams(var Params :TCreateParams); override;
...

procedure TForm5.CreateParams(var Params: TCreateParams);
begin
  inherited;
  Params.ExStyle := Params.ExStyle OR WS_EX_APPWINDOW;
end;

 

  • Like 1

Share this post


Link to post
12 minutes ago, Kryvich said:

I tried this suggestion for Delphi 7, and it still works in Rio and Windows 7. In TForm5:


  protected
    procedure CreateParams(var Params :TCreateParams); override;
...

procedure TForm5.CreateParams(var Params: TCreateParams);
begin
  inherited;
  Params.ExStyle := Params.ExStyle OR WS_EX_APPWINDOW;
end;

 

Oh, I didn't think this could be a Windows thing.. I have Windows 10.

 

I tried and now I get 2 taskbar buttons and no icons:

 

image.png.ac72e1b30fed5b8a9e6ce364ee5b7c81.png

Share this post


Link to post

I expect to see no splash form on the taskbar in the first place - neither with or without icon. When I create a new VCL application I have an additional line after Application.Initialize which leads to that behavior:

  Application.MainFormOnTaskbar := True;

 

  • Thanks 1

Share this post


Link to post

@Mike Torrettinni Check my demo app (attached). Works as needed in Windows 7 (I haven't Win10 here, sorry). Look at the project source:

program SplashApp;
uses
  SysUtils, Vcl.Forms,
  uSplashMain in 'uSplashMain.pas' {Form1},
  uSplashForm in 'uSplashForm.pas' {Form5};
{$R *.res}
begin
  Application.Initialize;
  Form5 := TForm5.Create(nil);
  try
    Application.MainFormOnTaskbar := True;
    Form5.Show;
    Form5.Update;
    Application.CreateForm(TForm1, Form1);
  Sleep(3000);
  finally
    Form5.Free;
  end;
  Application.Run;
end.

Form5 is a splash form, and Form1 is a app's main form. Also check menu Project | Options | Application | Forms. The splash Form5 is in the list of available forms (the right list).

SplashApp.zip

Edited by Kryvich
  • Like 1
  • Thanks 1

Share this post


Link to post

@KryvichThanks, in doesn't show icon in W10 and in W7 doesn't show the taskbar button at all, until main form.

This is my first time trying splash screen (my project needs 2.8-3.5s to open main form) on my PC, so probably it takes longer on more basic computers.

 

I did run some other apps, and it is true, as @Uwe Raabe mentioned, couldn't' find an application that has icon in splash scree... Delphi 10.2 doesn't show it. And as it seems is very Windows version specific behavior,

I guess I will leave it as no-icon, for now.

 

Edited by Mike Torrettinni

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×