Hide a form's taskbar button without using WS_EX_TOOLWIN

前端 未结 7 2195
太阳男子
太阳男子 2020-12-16 06:59

I need to hide a Windows form from the taskbar but I can\'t use WS_EX_TOOLWINDOW because I need the system menu and min/max buttons on the form\'s title bar.

7条回答
  •  天涯浪人
    2020-12-16 07:35

    With thanks to http://www.scalabium.com/faq/dct0096.htm.

    procedure TForm1.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;
    

    I tested it and it worked with Delphi2006. And windows menu and min/max buttons are still visible.

提交回复
热议问题