Delphi Programming causes the program not to appear on the system task bar

Source: Internet
Author: User

This example describes how to make a program not appear on the system task bar.

The initialization process of a program that adds code to the Formcreate () event of a form. In the program design phase, with the left mouse button double-click the form on the blank, on the screen will pop up a code window, the cursor moved to the formcreate () process of the processing code, and add the following code:

procedure TForm1.FormCreate(Sender: TObject);
begin
  SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
end;

At the beginning of the program run, the code in the form formcreate () is activated first, through SetWindowLong (Application.handle,gwl_exstyle,ws_ex_toolwindow) This statement enables you to hide this program from the System task bar.

The program code is as follows:

unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
  TForm1 = class(TForm)
  procedure FormCreate(Sender: TObject);
private
  { Private declarations }
public
  { Public declarations }
end;
var
  Form1: TForm1;
  implementation
  {$R *.dfm}
  procedure TForm1.FormCreate(Sender: TObject);
  begin
   SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
  end;
end.

Save the file, and then press F9 to run the program, and the results of the program run as shown in Figure 1.

Program Run result chart

This example demonstrates how to make a program not appear on the system's taskbar, taking full advantage of the functionality of the SetWindowLong function, as well as many additional styles for setting up programs.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.