Hide a form's taskbar button without using WS_EX_TOOLWIN

前端 未结 7 2205
太阳男子
太阳男子 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:27

    in Delphi XE (2010) this works perfectly: you shoud edit main form,

    program prog;  
    
    uses
    Forms,
    Unit1 in 'Unit1.pas' {Form1};
    
    begin
    Application.Initialize;
    
    // this value is set to "true", but you shoud set it "false"
    Application.MainFormOnTaskbar := false;
    
    Application.CreateForm(TForm1, Form1);
    Application.Run;
    end.
    

    (for this main form search in "modeling view" window)

    after this, go to unit1.pas, your main forms unit and "OnShow" event of form1 do:

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

    this will help, i had the same problem, searched whole net but without resolt

提交回复
热议问题