Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force application to show TaskBar Icon during OnCreate procedure

Tags:

delphi

I use delphi XE2. During my Main form OnCreate procedure I run some important elements, like login procedure and so on. My problem is, that when I show login form (invoked by OnCreate procedure), my application is not visible on TaskBar - it became visible when main form became visible. The problem is, that when user covered my login form by another application, without icon on taskBar he might not know that my application already runs and try to start it again. He must use ctrl+tab to get my application login form.

Now question... How to force application / OS to show application icon on Taskbar when OnCreate procedure is not finished?

regards Mario

like image 998
Mariusz Stefaniak Avatar asked Dec 11 '22 01:12

Mariusz Stefaniak


1 Answers

You can override the login form's CreateParams to include WS_EX_APPWINDOW ex-style.

type
  TLoginForm = class(TForm)
    ..

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

  end;

procedure TLoginForm.CreateParams(var Params: TCreateParams);
begin
  inherited;
  Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
end;
like image 65
Sertac Akyuz Avatar answered Dec 24 '22 00:12

Sertac Akyuz