Delphi 任务栏中不显示窗口

目的:

1. 窗口不在任务栏显示。

2. 窗口不显示在Alt+Tab的切换列表中。

3. 在任务管理器的应用程序列表中不显示。

示例:

type
  TAppWndBrowser = class( TForm )
    published
      procedure CreateParams( var Params: TCreateParams ); override;
      procedure WndProc(var Message: TMessage); override;
  end;

implementation

{$R *.dfm}


{ TAppWndBrowser }
procedure TAppWndBrowser.CreateParams( var Params: TCreateParams );
begin
  inherited CreateParams( Params );
  Params.ExStyle := WS_EX_TOOLWINDOW;
end;

procedure TAppWndBrowser.WndProc(var Message: TMessage);
begin
  inherited WndProc(Message);
  if (not Application.MainFormOnTaskBar) and (Message.Msg = WM_SHOWWINDOW) then
  begin
    ShowWindow(Application.Handle, SW_HIDE);
    SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
  end;
end;
致读者:本人自学编程,知识薄弱,实践经验不够,博客文章难免有错误之处,希望读者能积极指正,感激不尽。 若您有更精妙的解决方案或者对文中有疑问,欢迎留言或联系我讨论问题。
原文地址:https://www.cnblogs.com/it89/p/12029526.html