0
votes

Somebody know what event in Delphi is fired when I click on miniature of application window on taskbar ?

For example after I move mouse over application icon on taskbar I can see two miniatures of two different opened app windows,and now I want to bring to front window,which miniature I click

On taskbar I have 2 miniatures : Of mainform and form opened from mainform using

 with TfrZadaniaMain.Create(Application) do
  try
   Show;

where TfrZadaniaMain is name of second form visible in miniatures.

And I have problems with switching between this two forms by clicking on it miniature

In create params of TfrZadaniaMain I have:

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

but this doesn't help. On both mainform and TfrZadaniaMain on FormActivate event I have BringToFront,but probably I need something more to comfortable switching between these two forms


On taskbar I have 2 miniatures : Of mainform and form opened from mainform using

 with TfrZadaniaMain.Create(Application) do
  try
   Show;

where TfrZadaniaMain is name of second form visible in miniatures.

And I have problems with switching between this two forms

In create params of TfrZadaniaMain I have:

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

but this doesn't help. On both mainform and TfrZadaniaMain on FormActivate event I have BringToFront,but probably I need something more to comfortable switching between these two forms

2
I don't really know, but - since in case of minimized windows it indicates a "restore window" event - I would strongly guess that a WM_SIZE message will be sent to your application. In case of non-minimized windows I think your window get the focus. If you want to perform something more complex I would suggest you read about taskbar APIsmg30rg
".. I can see two miniatures .." That's not default behavior. By default, either the application's window has a button (MainFormOnTaskBar=False) - in which case there's a single thumbnail of a single (arbitrary?) form, or the main form has a button (MainFormOnTaskbar=True) - in which case there's a single thumbnail of the main form.Sertac Akyuz
My point being, it's not quite possible to suggest without knowing what you have done.Sertac Akyuz
Based on OP explanation he has two instances of the same application opened or he has multiple forms and each form creates a taskbar icon "I can see two miniatures of two different opened app windows".SilverWarior
It's still far from clear what state your windows are in or even how many processes you have.David Heffernan

2 Answers

0
votes

As for your original question about which event is first fired when Application is restored from minimized state:

The first event fired is TApplication.OnRestore http://docwiki.embarcadero.com/Libraries/XE7/en/Vcl.Forms.TApplication.OnRestore

Don't confuse this one with TForm.OnRestore event as they are different.

TApplication.OnRestore is only fired when Application is restored from minimized state (no mater which form has restored the application)

TForm.OnRestore is fired when specific Form is restored from either Minimized or Maximized state and is specific for each individual Form.

-1
votes

Ok finally I found the solution !

Thanks to this site

The solution is to add WndParent := GetDesktopwindow; in TfrZadaniaMain.CreateParams.

Now when I click on miniature of each form (Main or TfrZadaniaMain ) the requested (clicked) form appear.