简体   繁体   English

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

[英]C# - Windows 7 taskbar shows AssemblyTitle instead of Form.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. 我有一个不包含标题栏的Windows窗体应用程序,在Windows 7上,任务栏显示AssemblyTitle的值,而不是表单的Text属性中的值。 How can I change this value dynamically? 如何动态更改此值?

Thanks! 谢谢!

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. 我尝试在我正在编写的程序中更改此项并得出结论(至少在托管代码中)它无法完成 - Win 7在可执行文件中获取FileDescription的值(AssemblyTitle是Win Forms中的代理)应用程序)并使用它。 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. 据我所知,对于正在运行的程序集,无法更改程序集属性,我不确定Windows是否会注意到更改并更新跳转列表,即使您可以执行此操作也是如此。

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. Win 7 API( Windows API代码包 )有一个托管包装器,虽然有一个用于操作跳转列表的类,但我发现其中没有任何内容可以覆盖它们的这个特定方面的默认行为。

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 . 编辑:仔细查看本机API(与托管的Code Pack包装器相反),我找不到任何功能,但我确实发现了这个MSDN博客条目 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: 在第二个图表(将应用程序标题定义为“任务栏任务”部分的一部分)和Windows SDK引用之下,有一个开发人员可以执行的活动列表,它包括以下内容:

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. 所以看起来它是不可能的 - 跳转列表的这一部分完全由操作系统控制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM