简体   繁体   English

如何在c ++ builder中隐藏任务栏中的表单?

[英]How to hide form from taskbar in c++ builder?

I have simple VCL Forms application which on start show on taskbar button if is in use, what i want to do is to hide those button, so that mean whatever is happen with form that those button don't appear. 我有简单的VCL Forms应用程序,如果正在使用,在任务栏按钮上开始显示,我想要做的是隐藏那些按钮,这意味着那些按钮不出现的形式发生的任何事情。 Case can be that forms is shown or hidden or any other but button have to be hidden, how to do that? 案例可以是显示或隐藏的表格或任何其他但必须隐藏按钮,如何做到这一点?

PS I see that question like this exist but they don't work in my cause. PS我看到这样的问题存在,但它们在我的事业中不起作用。

Try the following approach: 尝试以下方法:

  • Set MainFormOnTaskBar to false 将MainFormOnTaskBar设置为false
  • Call ShowWindow(Application->Handle, SW_HIDE); 调用ShowWindow(Application-> Handle,SW_HIDE); inside the main form's OnShow event handler. 在主窗体的OnShow事件处理程序中。
  • Call ShowWindow(Application->Handle, SW_HIDE); 调用ShowWindow(Application-> Handle,SW_HIDE); inside the main form's OnActivate event handler. 在主窗体的OnActivate事件处理程序中。

Source: http://delphi.about.com/od/delphitips2008/qt/hide_taskbutton.htm 资料来源: http//delphi.about.com/od/delphitips2008/qt/hide_taskbutton.htm

Not only did I have to do what Spook answered, but also (thanks to http://codeverge.com/embarcadero.cppbuilder.ide/builder-c++-xe-and-hiding-taskbar/1073223 ) 我不仅要做Spook的回答,而且还要感谢http://codeverge.com/embarcadero.cppbuilder.ide/builder-c++-xe-and-hiding-taskbar/1073223

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  Application->MainFormOnTaskBar = false;
  DWORD dwExStyle = GetWindowLong(Application->Handle, GWL_EXSTYLE);
    dwExStyle &= ~WS_EX_APPWINDOW;
    dwExStyle |= WS_EX_TOOLWINDOW;
    SetWindowLong(Application->Handle, GWL_EXSTYLE, dwExStyle);
}
void __fastcall TForm1::FormActivate(TObject *Sender)
{
    ShowWindow(Application->Handle, SW_HIDE);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::CreateParams(TCreateParams &Params)
{
    TForm::CreateParams(Params);
    Params.ExStyle &= ~WS_EX_APPWINDOW;
    Params.ExStyle |= WS_EX_TOOLWINDOW;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM