Hide a Delphi Application Button from the TaskBar
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.
To hide your Delphi application (button) from the TaskBar you need to change some specific attributes of the Application window. Here's how...
The code above is the handler for the TMainForm's OnCreate event. Presumably, "TMainForm" is the main form of your application.
In order to hide the button on the TaskBar you need to use the SetWindowLong API function that changes an attribute of the specified window. By applying WS_EX_TOOLWINDOW for the GWL_EXSTYLE you mark the application window as a toolbar window. A tool window does not appear in the taskbar or in the dialog box that appears when the user presses ALT+TAB.
To remove the flicker when calling the SetWindowLong, you first hide the window then show it again using ShowWindow with parameters SW_HIDE and SW_SHOW.
Here's how to Hide a Delphi 2007 Application Button from the TaskBar (with MainFormOnTaskBar)
Delphi tips navigator:
» MORE TIPS
« Desktop Screen Shot using Delphi Code
To hide your Delphi application (button) from the TaskBar you need to change some specific attributes of the Application window. Here's how...
procedure TMainForm.FormCreate(Sender: TObject) ; begin ShowWindow(Application.Handle, SW_HIDE) ; SetWindowLong(Application.Handle, GWL_EXSTYLE, getWindowLong(Application.Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW) ; ShowWindow(Application.Handle, SW_SHOW) ; end;
The code above is the handler for the TMainForm's OnCreate event. Presumably, "TMainForm" is the main form of your application.
In order to hide the button on the TaskBar you need to use the SetWindowLong API function that changes an attribute of the specified window. By applying WS_EX_TOOLWINDOW for the GWL_EXSTYLE you mark the application window as a toolbar window. A tool window does not appear in the taskbar or in the dialog box that appears when the user presses ALT+TAB.
To remove the flicker when calling the SetWindowLong, you first hide the window then show it again using ShowWindow with parameters SW_HIDE and SW_SHOW.
Not working with Delphi 2007 :(
For applications created with Delphi 2007 the above code will not work - taskbar button will not be hidden.Here's how to Hide a Delphi 2007 Application Button from the TaskBar (with MainFormOnTaskBar)
Delphi tips navigator:
» MORE TIPS
« Desktop Screen Shot using Delphi Code
Source...