RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TApplication.MainFormOnTaskBar Property

Controls how Windows taskbar buttons are handled by VCL.

Pascal
property MainFormOnTaskBar: Boolean;
C++
__property Boolean MainFormOnTaskBar;

The MainFormOnTaskBar property controls how Windows taskbar buttons are handled by VCL. 

If the property is true, a taskbar button represents the application's main form and displays its caption. If false, a taskbar button represents the application's (hidden) main window and bears the application's Title

MainFormOnTaskBar must be true to use Windows Vista Aero effects. These include live taskbar thumbnails, Dynamic Windows, Windows Flip, and Windows Flip 3D. 

If a change to default behavior is required, MainFormOnTaskBar should be set in the .dpr file after Application.Initialize and before main form creation. The MainFormOnTaskBar setting is intended to persist for the life of the application; later runtime changes of this property could result in unexpected behavior. 

MainFormOnTaskBar defaults to True for applications created in Delphi 2007 and later products and False for earlier products. 

The property can be applied to older applications. Note that it affects the Z-order of your MainForm in case your application depends on this.  

To update existing VCL applications, add the following line to the project's .dpr file after Application.Initialize;:

Application.MainFormOnTaskbar := True;

This line is automatically added to new projects. 

For further information, see http://www.microsoft.com/windows/products/windowsvista/features/experiences/aero.mspx.  

Delphi Examples: 

 

{
This example shows progress of loading forms as an
application starts up. The code example is placed in the
project source (*.dpr) file.  To see project source, right
click on the executable file in the Project Manager and
select the View Source menu item.  You will need to set up
your project with the following steps before using the codeexample:    Add four additional forms to a default project. 
    Place a TProgressBar on Form5
    Take the Project|Options|Forms menu option and place 
          Form5 on the available forms list.
    Change the code of your project (*.dpr) file to look
          like the example.
}
begin
  Application.Initialize;
  with TForm5.Create(nil) do
  try
    Application.MainFormOnTaskbar := True;
    ProgressBar1.Max := 100;
    Show;  // show a splash screen contain ProgressBar control
    Update; // force display of Form5
    Application.CreateForm(TForm1, Form1);
    ProgressBar1.StepBy(25);
    Label1.Caption :=  'Form1 loaded successfully.';
    Update; // force display of Form5
    Sleep(3000);
    Application.CreateForm(TForm2, Form2);
    ProgressBar1.StepBy(25);
    Label1.Caption :=  'Form2 loaded successfully.';
    Update; // force display of Form5
    Sleep(3000);
    Application.CreateForm(TForm3, Form3);
    ProgressBar1.StepBy(25);
    Label1.Caption :=  'Form3 loaded successfully.';
    Update; // force display of Form5
    Sleep(3000);
    Application.CreateForm(TForm4, Form4);
    ProgressBar1.StepBy(25);
    Label1.Caption :=  'Form4 loaded successfully.';
    Update; // force display of Form5
    Sleep(3000);
  finally
    Free;
  end;
  Application.Run;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!