C# - Windows 7 任务栏显示 AssemblyTitle 而不是 Form.Text

发布于 2024-09-19 04:34:07 字数 112 浏览 4 评论 0原文

我有一个不包含标题栏的 Windows 窗体应用程序,在 Windows 7 上,任务栏显示 AssemblyTitle 中的值,而不是窗体的 Text 属性中的值。如何动态改变这个值?

谢谢!

I have a Windows Forms application that does not include a title bar, and on Windows 7, the taskbar shows the value from AssemblyTitle, rather than the value from the form's Text property. How can I change this value dynamically?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

顾北清歌寒 2024-09-26 04:34:07

根据您的评论,我认为您指的是该程序的“跳转列表”,其中包括程序标题(如果单击它,则会启动该程序的另一个实例)。我的理解是,您所看到的是所有应用程序的默认行为,无论表单上标题栏的可见性如何。

我尝试在我正在编写的程序上更改此设置,并得出结论(至少在托管代码中)无法完成 - Win 7 获取可执行文件中 FileDescription 的值(AssemblyTitle 是 Win Forms 中的代理)应用程序)并使用它。据我所知,无法更改正在运行的程序集的程序集属性,并且我不确定 Windows 是否会注意到更改并更新跳转列表,即使您可以做到这一点。

Win 7 API 有一个托管包装器(Windows API Code Pack< /a>),尽管有一个用于操作跳转列表的类,但我发现其中没有任何内容可以覆盖它们的这个特定方面的默认行为。

编辑:
更仔细地查看本机 API(而不是托管代码包包装器),我找不到任何函数,但我确实发现了这个 MSDN 博客条目。就在第二个图(将应用程序标题定义为“任务栏任务”部分的一部分)和 Windows SDK 引用下方,有一个开发人员可以执行的活动列表,其中包括以下内容:

作为开发者,我们无法控制
任务栏任务。

所以看起来这是不可能的 - 跳转列表的这一部分完全由操作系统控制。

From your comments, I think you're referring to the "jump list" for the program, which includes a program title (if you click on it, an additional instance of the program is launched). My understanding is that what you're seeing is the default behaviour for all applications, regardless of the visibility of the title bar on your Form.

I tried to change this on a program I was writing and came to the conclusion that (at least within managed code) it cannot be done - Win 7 takes the value of the FileDescription in the executable (AssemblyTitle is a proxy for this in Win Forms apps) and uses this. As far as I know, assembly attributes cannot be altered for a running assembly and I'm not sure Windows would notice a change and update the jump list even if you could do it.

There is a managed wrapper for the Win 7 API (the Windows API Code Pack), and although there is a class for manipulating Jump Lists, I found nothing within it to override the default behaviour for this particular aspect of them.

Edit:
Looking more closely into the native API (as opposed to the managed Code Pack wrapper), I couldn't find any functions but I did discover this MSDN blog entry. Just under the second diagram (which defines the application title as part of the "Taskbar Tasks" section) and the Windows SDK quote, there is a list of activities developers can perform and it includes the following:

As developers we have no control over
the Taskbar Tasks.

So it looks like it's just not possible - this section of the Jump List is controlled exclusively by the OS.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文