In all Delphi versions up to Delphi 2007, the button on the Windows TaskBar, for a Delphi application, belongs to the Application window, the hidden window maintained by the Application object, not the main form window.
With Delphi 2007, a new property of the Application object, the MainFormOnTaskbar property controls how Windows taskbar buttons are handled by VCL.
If MainFormOnTaskbar 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.
By design, the MainFormOnTaskbar property is set to true for any new Delphi 2007 application. You can change this value by editing the projects (DPR) source code. MainFormOnTaskBar should be set after Application.Initialize and before main form creation.
Hide the Taskbar button for Delphi <= 2006With Delphi versions up to Delphi 2007 a simple tweak to the application's window style using the SetWindowLong API call allowed you to hide the taskbar button (Delphi <= 2006).
This code no longer works with Delphi 2007!
Hide the Taskbar button for Delphi 2007With Delphi 2007, to hide the taskbar button you'll need a few code lines:
- Set MainFormOnTaskBar to FALSE
inside the main form's OnShow event handler.
inside the main form's OnActivate event handler.