...hide a program from the taskbar?

Author: Simon Grossenbacher
Homepage: http://www.swissdelphicenter.ch

Category: System

procedure TMainForm.FormShow(Sender: TObject);
var
  
hwndOwner: HWnd
begin
  
hwndOwner := GetWindow(Handle, GW_OWNER);
  ShowWindow(hwndOwner, SW_HIDE);
  // For Windows 2000, additionally call the ShowWindowAsync function:
  
ShowWindowAsync(hwndOwner, SW_HIDE);
  ShowWindowAsync(Self.Handle, SW_HIDE);
end;

{
  Prevent the form from reappearing on the Taskbar after minimizing it:

  Verhindern, dass nach einem Minimize die Applikation wieder in der Taskbar
  erscheint:
}

private
  procedure 
WMSysCommand(var msg: TWMSysCommand); message WM_SysCommand;

{....}

implementation

procedure 
TMainForm.WMSysCommand(var msg: TWMSysCommand);
begin
  if 
msg.CmdType and $FFF0 = SC_MINIMIZE then
    
hide
  else
    inherited
;
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base