Hiding your application from the Taskbar

'

The following Delphi code snippets show you how to hide your application from the taskbar.

The first method uses the Delphi VCL way whilst the second technique uses the Windows API.

procedure TForm1.HideButton(Sender: TObject);
begin
  ShowWindow(Application.Handle,SW_HIDE);
end;

procedure TForm1.ShowButton(Sender: TObject);
begin
  ShowWindow(Application.Handle,SW_SHOW);
end;

And now using the Windows API

var
  m_hWnd : HWND;
  hMain : HWND;

procedure TForm1.CreateWindow(Sender: TObject);
begin
 m_hWnd :=CreateWindowEx(0,'staic', '', WS_POPUP, 0,0,1600,1200,
   0, 0, 0, nil);
 hMain := CreateWindowEx (0,'static', 'Main window',
  WS_POPUP + WS_VISIBLE, 40,50,200,300,m_hWnd, 0, 0, nil);
end;

procedure TForm1.HideWindow(Sender: TObject);
begin
  //hide button
  ShowWindow(hMain,SW_HIDE);
end;

procedure TForm1.ShowWindow(Sender: TObject);
begin
  //show button
  ShowWindow(hMain,SW_SHOW);
end;

Google
Web www.Delphi-Central.com
Delphi Central - Delphi Programming Tutorials, Hints and Tips