从 Windows 10 上的任务栏中删除窗口 [英] Remove window from taskbar on Windows 10

查看:52
本文介绍了从 Windows 10 上的任务栏中删除窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从具有多个桌面的 Windows 10 上的任务栏中删除窗口.对于 Windows 8.1,我使用了 ITaskbarList::DeleteTab 并且效果很好.

I want to remove window from taskbar on Windows 10 with multiple desktops. For Windows 8.1 i used ITaskbarList::DeleteTab and it works excellent.

对于 Windows 10,此方法也会从任务栏隐藏 Windows,但之后我会在所有桌面上看到此窗口.我只想在一个桌面上看到这个窗口.

For Windows 10 this method hides Windows from taskbar too, but after it i see this window on all desktops. I want to see this window only on one desktop.

有谁知道在 Windows 10 中从任务栏隐藏窗口并将此窗口保留在一个桌面上的方法吗?

Does anyone know the method to hide window from task bar in Windows 10 and stay this window on one desktop?

下面你可以看到,我在在 Windows 10 的任务栏中隐藏窗口"下的意思:

Below you can see, what i meant under "hide window from task bar in Windows 10":

推荐答案

据我所知,根据我的经验测试,任务栏预览中出现的窗口与通常出现在任务栏中的窗口完全相同.很久以前,比如在 Windows 2000 中,应用程序的每个符合条件的窗口都只会在任务栏上显示为按钮.从 Windows XP 开始,任务栏分组成为一个选项,这样来自单个应用程序的所有符合条件的窗口都可以组合在一起并在任务栏上显示为单个按钮.然后,在 Windows Vista 中,当您将鼠标悬停在相应的任务栏按钮上时,就可以显示这些打开窗口的预览.Windows 8 和 Windows 10 都没有改变这一基本规则;他们只改变了预览的外观.

In my understanding, borne out by my empirical tests, the windows that appear in the taskbar previews are exactly the same windows that would ordinarily appear in the taskbar. A long time ago, say in Windows 2000, each of an application's eligible windows would just appear as buttons on the taskbar. Starting in Windows XP, taskbar grouping became an option, so that all eligible windows from a single application could be grouped together and appear as a single button on the taskbar. Then, in Windows Vista, it became possible to display previews of these open windows when you hovered over the corresponding taskbar button. Neither Windows 8 nor Windows 10 changed that fundamental rule; they only changed the appearance of the previews.

因此,我们可以参考 MSDN 文档 有关任务栏上显示哪些窗口的规则:

As such, we can refer back to the MSDN documentation for the rules about which windows appear on the taskbar:

每当应用程序创建一个不属于自己的窗口时,Shell 就会在任务栏上创建一个按钮.要确保窗口按钮位于任务栏上,请使用 WS_EX_APPWINDOW 扩展样式创建一个无主窗口.为防止窗口按钮放置在任务栏上,请使用 WS_EX_TOOLWINDOW 扩展样式创建无主窗口.作为替代方法,您可以创建一个隐藏窗口并使这个隐藏窗口成为您可见窗口的所有者.

The Shell creates a button on the taskbar whenever an application creates a window that isn't owned. To ensure that the window button is placed on the taskbar, create an unowned window with the WS_EX_APPWINDOW extended style. To prevent the window button from being placed on the taskbar, create the unowned window with the WS_EX_TOOLWINDOW extended style. As an alternative, you can create a hidden window and make this hidden window the owner of your visible window.

Raymond Chen 更准确地总结了这些规则此处.引用他的话:

Raymond Chen has summarized these rules more precisely here. Quoting him:

关于哪些窗口进入任务栏有一些基本规则.简而言之:

There are some basic rules on which windows go into the taskbar. In short:

  • 如果设置了 WS_EX_APPWINDOW 扩展样式,那么它将显示(当可见时).
  • 如果窗口是顶级无主窗口,那么它将显示(当可见时).
  • 否则它不会显示.
  • If the WS_EX_APPWINDOW extended style is set, then it will show (when visible).
  • If the window is a top-level unowned window, then it will show (when visible).
  • Otherwise it doesn't show.

(虽然 ITaskbarList涨一点.)

你之前把它搞混了,调用了ITaskbarList::DeleteTab.那是没有必要的.为确保窗口不会出现在任务栏中,只需应用控制窗口何时出现在任务栏中的相反规则.

You were muddying it up before, calling ITaskbarList::DeleteTab. That is not necessary. To ensure that a window does not appear in the taskbar, just apply the converse of the rules governing when a window does appear in the taskbar.

如果您有一个顶级无主窗口,它将显示在任务栏中,除非您删除WS_EX_APPWINDOW 扩展窗口样式.如果您有一个拥有的窗口,那么它将不会显示在任务栏中,除非将 WS_EX_APPWINDOW 扩展窗口样式设置为强制它出现在那里.

If you have a top-level unowned window, it will be shown in the taskbar unless you remove the WS_EX_APPWINDOW extended window style. If you have an owned window, then it will not be shown in the taskbar unless the WS_EX_APPWINDOW extended window style is set to force it there.

因此,如果您设置了 WS_EX_APPWINDOW 扩展窗口样式,则应将其删除.即强制窗口显示在任务栏中.

So if you have the WS_EX_APPWINDOW extended window style set, you should remove it. That is forcing the window to be displayed in the taskbar.

否则,您应该为窗口设置所有者.例如,让第二个窗口归第一个所有.

Otherwise, you should set an owner for your window. For example, make the second window be owned by the first.

这篇关于从 Windows 10 上的任务栏中删除窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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