title: Delphi Form Hiding from Taskbar and Alt+Tab
body: <p>I am a delphi learner. I wish to hide my Delphi application from Taskbar and Alt+Tab. So I have defined the following codes :</p>
  
  <pre><code>unit KoushikHalder01;
  
  interface
  
  uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs;
  
  type
    TMainForm = class(TForm)
      procedure FormCreate(Sender: TObject);
      procedure FormShow(Sender: TObject);
      procedure FormActivate(Sender: TObject);
    private
      { Private declarations }
    public
      { Public declarations }
    end;
  
  var
    MainForm: TMainForm;
  
  implementation
  
  {$R *.dfm}
  
  procedure TMainForm.FormActivate(Sender: TObject);
  begin
    ShowWindow(Application.Handle, SW_HIDE);
  end;
  
  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;
  
  procedure TMainForm.FormShow(Sender: TObject);
  begin
    ShowWindow(Application.Handle, SW_HIDE);
  end;
  
  end.
  </code></pre>
  
  <p>and</p>
  
  <pre><code>program KoushikHalder;
  
  uses
    Vcl.Forms,
    KoushikHalder01 in 'KoushikHalder01.pas' {MainForm};
  
  {$R *.res}
  
  begin
    Application.Initialize;
    Application.MainFormOnTaskbar := false;
    Application.CreateForm(TMainForm, MainForm);
    Application.Run;
  end.
  </code></pre>
  
  <p>It works for the first time only. But there is some problems as follows :</p>
  
  <ol>
  <li>Application is vissible in Alt+Tab.</li>
  <li>If I minimize the application and again restore it the application is still on taskbar.</li>
  <li>When the application is vissible on Taskbar, it shows the name of the compiled exe file name but not the caption of the MaimForm.
  Please help me.</li>
  </ol>