不使用 WS_EX_TOOLWIN 隐藏表单的任务栏按钮 [英] Hide a form's taskbar button without using WS_EX_TOOLWIN

查看:26
本文介绍了不使用 WS_EX_TOOLWIN 隐藏表单的任务栏按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从任务栏隐藏 Windows 窗体,但我不能使用 WS_EX_TOOLWINDOW,因为我需要窗体标题栏上的系统菜单和最小/最大按钮.

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.

如果我在运行时将表单切换到工具窗口,表单皮肤就会被塞满.从网上搜索我看到 VB 有一个 ShowInTaskbar 属性,我想知道这是否能满足我的要求,以及它是否可以在 Delphi 2006 中实现.此外,这个项目是一个 COM 服务器,没有 MainForm 等.

If I switch the form to a tool window at runtime the form skinning is stuffed up. From searching on the Web I see that VB has a ShowInTaskbar property and I'm wondering if this would do what I want, and whether it can be implemented in Delphi 2006. Also this project is a COM server and has no MainForm, etc.

推荐答案

有一个关于这个确切问题的有趣讨论 这里(来自 VB6 的观点).

There's an interesting discussion of this exact problem here (from a VB6 persepective).

从您的问题的角度来看,最相关的一点是:

The most relevant bit from your question's perspective is:

"创建窗口时,任务栏检查窗口的扩展样式看看是否 WS_EX_APPWINDOW(&H40000) 或 WS_EX_TOOLWINDOW (&H80)样式已打开.如果 WS_EX_APPWINDOW已打开,任务栏显示窗口的按钮,如果 WS_EX_TOOLWINDOW打开,任务栏不显示窗口按钮.一个窗口不应该同时具有这些扩展样式.如果窗户没有这两种风格,任务栏决定创建一个按钮如果窗口是无主的并且没有如果窗口是,则创建一个按钮拥有."

"When you create a window, the taskbar examines the window's extended style to see if either the WS_EX_APPWINDOW (&H40000) or WS_EX_TOOLWINDOW (&H80) style is turned on. If WS_EX_APPWINDOW is turned on, the taskbar shows a button for the window, and if WS_EX_ TOOLWINDOW is turned on, the taskbar does not show a button for the window. A window should never have both of these extended styles. If the window doesn't have either of these styles, the taskbar decides to create a button if the window is unowned and does not create a button if the window is owned."

顺便说一下,你使用了 GetWindow带有 GW_OWNER 标志的 API 函数判断一个窗口是否被拥有.

Incidentally, you use the GetWindow API function with the GW_OWNER flag to determine whether a window is owned.

这篇关于不使用 WS_EX_TOOLWIN 隐藏表单的任务栏按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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