Mike Torrettinni 198 Posted February 1, 2019 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. When main form is shown, the icon is there: 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? 1 Share this post Link to post
PeterBelow 239 Posted February 2, 2019 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
Mike Torrettinni 198 Posted February 2, 2019 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
Kryvich 165 Posted February 2, 2019 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; 1 Share this post Link to post
Mike Torrettinni 198 Posted February 2, 2019 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: Share this post Link to post
Uwe Raabe 2064 Posted February 2, 2019 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; 1 Share this post Link to post
Kryvich 165 Posted February 2, 2019 (edited) @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 February 2, 2019 by Kryvich 1 1 Share this post Link to post
Mike Torrettinni 198 Posted February 2, 2019 (edited) @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 February 2, 2019 by Mike Torrettinni Share this post Link to post
Attila Kovacs 631 Posted January 8, 2020 @Kryvich thx, works as you described. (db login-error-form, prior to any other, including main-form created) Share this post Link to post