Taskbar-button per form in an application
2005-06-08 20:41 i89 [permalink]
If you want each form in an application to have a taskbar-button of its own, you need to add this code somewhere between the private and public section of the class declaration of your TForm descendant type:
protected
procedure CreateParams(var Params: TCreateParams); override;
At the bottom add this (where Form1 is the name of your form):
procedure TForm1.CreateParams(var Params: TCreateParams);The virtual CreateParams procedure defined by the base TForm class, is used to modify the parameters used to call the Windows functions to do the work, before creating the window on screen. By setting the parent window to the desktop, a taskbar-button appears, with the icon and caption of the form. It also has the full default SystemMenu with all the options (according to the BorderIcons property of the form). The SystemMenu on the taskbar-button that is created by/for the Application object, is typically missing the Move and Size options.
begin
inherited;
Params.WndParent:=GetDesktopWindow;
end;