隐藏任务栏窗口,而无需使用WS_EX_TOOLWINDOW [英] Hide Window from taskbar without using WS_EX_TOOLWINDOW
问题描述
我有一个主窗口和About窗口,关于窗口从主窗口中打开,但问题是关于窗口在任务栏中显示!
I have a main Window and an About Window, The About Window is opened from the main Window, but the problem is that the About Window is shown in the taskbar!
我发现,为了隐藏任务栏窗口,我可以使用 WS_EX_TOOLWINDOW
的风格,但我不希望关于窗口有这种风格,所以有另一种方式来做到这一点?
I have found that in order to hide a Window from the taskbar, I can use the WS_EX_TOOLWINDOW
style, but I don't want the About Window to have this style, so is there another way to do it?
推荐答案
简化一点,窗口将重新$ P $任务栏,如果psented:
Simplifying a little, a window is represented in the taskbar if:
- 它不拥有,不具有WS_EX_TOOLWINDOW扩展样式,或
- 它有WS_EX_APPWINDOW扩展样式。
所以,您的解决方案是使窗口所拥有。它应该由你的应用程序的主窗口所拥有。当你创建了关于窗口传递的主窗口句柄为 hWndParent
。
So, the solution for you is to make the window be owned. It should be owned by the main window of your application. Pass the main window handle as hWndParent
when you create the about window.
hWndAbout := CreateWindowEx(..., hWndMainWindow, ...);
^^^ hWndParent
除了解决与任务栏上的问题,设置店主也将确保有关窗口总是在主窗口的顶部。
As well as resolving the problem with the taskbar, setting the owner will also ensure that the about window is always shown on top of the main window.
这篇关于隐藏任务栏窗口,而无需使用WS_EX_TOOLWINDOW的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!