如何在Windows 7中隐藏任务栏中的应用程序? [英] How to hide an application from taskbar in Windows 7?

查看:286
本文介绍了如何在Windows 7中隐藏任务栏中的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从Windows 7任务栏中隐藏一个应用程序。



我想在屏幕的边缘做一些工具栏,当用户点击它时,会做某些事情,但我不希望它显示在任务栏,因为它是一个我想留在后台的东西。



我尝试了以下帖子中的说明,但是它在我的应用程序上无效: / p>

如何隐藏任务栏条目,但保留窗口窗体



然后我尝试在一个新的空的VCL Forms应用程序,它仍然没有工作。我搜索了其他解决方案,但是它们在链接的帖子中都是一样的。



有什么改变,这在Windows 7中是不可能的?还是有
可以想到的东西,这可以阻止它的工作?

解决方案

你可以覆盖主表单的 CreateParam 删除强制任务栏按钮( WS_EX_APPWINDOW )的标志,另外使表单拥有由应用程序窗口。这就是为了向窗口放置一个任务栏按钮的shell的相反的。从管理任务栏按钮


[..]为确保窗口按钮放置在任务栏上,请创建一个
未知窗口, strong> WS_EX_APPWINDOW 扩展样式。 [..]


示例:

  type 
TForm1 = class(TForm)
protected
procedure CreateParams(var Params:TCreateParams);覆盖
结束

procedure TForm1.CreateParams(var Params:TCreateParams);
开始
继承;
Params.ExStyle:= Params.ExStyle而不是WS_EX_APPWINDOW;
Params.WndParent:= Application.Handle;
结束

不要更改 MainFormOnTaskbar 如果您使用此方法,则应用程序属性的默认值为True。



您还可以删除第二行(..WndParent:= ..)和而是将对象检查器的 PopupMode 设置为 pmExplicit






BTW,这里是解决方案相同主题的文档引用 TLama发布


为防止窗口按钮被放置在任务栏上,[...]
作为另一种选择,您可以创建一个隐藏的窗口,并使这个隐藏的
窗口成为您可见窗口的所有者。


当您将 MainFormOnTaskbar 设置为false时,主窗体由VCL设计由应用程序窗口拥有。如果您隐藏了应用程序窗口,则满足要求。


I would like to hide an application from the Windows 7 taskbar.

I want to make something like a toolbar on the edge of the screen which does certain things when the user clicks on it, but I don't want it to show in the taskbar, since its a thing that i want to stay in the background.

I tried the instructions in the following post, but it did not work on my application:

How to hide a taskbar entry but keep the window form

Then i tried it on a new empty VCL Forms Application and it still did not work. I searched for other solutions, but they all do very much the same like in the linked post.

Has something changed, that makes that impossible in windows 7? Or is there anything you could think of, that could prevent it from working?

解决方案

You can override the main form's CreateParam to remove the flag that forces the taskbar button (WS_EX_APPWINDOW) and additionally make the form owned by the application window. That's doing the opposite of the requirement for the shell to place a taskbar button for a window. From "Managing Taskbar Buttons":

[..] To ensure that the window button is placed on the taskbar, create an unowned window with the WS_EX_APPWINDOW extended style. [..]

Sample:

type
  TForm1 = class(TForm)
  protected
    procedure CreateParams(var Params: TCreateParams); override;
  end;

procedure TForm1.CreateParams(var Params: TCreateParams);
begin
  inherited;
  Params.ExStyle := Params.ExStyle and not WS_EX_APPWINDOW;
  Params.WndParent := Application.Handle;
end;

Don't change the state of MainFormOnTaskbar property of the 'Application' from its default 'True' if you use this method.

You can also remove the second line (..WndParent := ..) and instead set PopupMode of the form to pmExplicit in the object inspector to same effect.


BTW, here's the documentation quote from the same topic for the solution TLama posted:

To prevent the window button from being placed on the taskbar, [...] As an alternative, you can create a hidden window and make this hidden window the owner of your visible window.

When you set MainFormOnTaskbar to false, the main form is owned by the application window by VCL design. And if you hide the application window, the requirement is fulfilled.

这篇关于如何在Windows 7中隐藏任务栏中的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆