在任务管理器的应用程序选项卡设置应用程序的名称应用程序、选项卡、任务管理器、名称

2023-09-03 01:46:06 作者:听风说旧人

我已经写在C#.NET 3.5需要显示在任务管理器的应用程序选项卡的特定名称的WinForms应用程序。不过,我需要这个文本是从该窗体的文本不同。

I have a WinForms application written in C# for .NET 3.5 that needs to show a specific name in the Task Manager's Applications tab. However, I need for this text to be different from the Form's text.

我到目前为止看到的行为是任务管理器应用程序选项卡将显示System.Windows.Forms.Form中的Text属性的值显示。不过,我想显示在Form.Text性应用程序的长名称,并在任务管理器的应用程序选项卡使用缩写名称。

The behavior I've seen so far is that the Task Manager Applications tab will show the value of the Text property of the System.Windows.Forms.Form being displayed. However, I'd like to display the long name of the application in the Form.Text property, and use an abbreviated name in the Task Manager's Applications tab.

我知道这种行为在VB6,其中应用程序标题被支持(通过项目属性设置 - >使标签 - >应用程序标题字段中,还是在.VBP文件本身)会在应用程序选项卡中显示的名称。有没有一种方法来复制在C#这个功能/。NET?

I know this behavior was supported in VB6, where the Application Title (Set through Project Properties -> Make tab -> Application Title field, or in the .VBP file itself) would be the name displayed in the Applications tab. Is there a way to replicate this functionality in C#/.NET?

这从MSDN位的信息似乎表明,Text属性是.NET的唯一来源:的应用对象为Visual Basic 6.0用户。不过,我想知道是否有办法解决。

This bit of information from MSDN seems to indicate that the Text property is the only source in .NET: App Object for Visual Basic 6.0 Users. However, I'd like to know if there's a way around this.

推荐答案

VB6.0表单应用程序使用一个隐藏的停车窗口作为应用程序的真正主窗口。这是怎么让任务管理器名称从主窗口的名称有所不同。 .NET应用程序的主窗口是应用程序的真正主窗口。

VB6.0 forms applications used a hidden "parking window" as the true main window of the application. This is how it allowed the task manager name to differ from the main window name. In .Net applications the main window is the true main window of the application.

您可以通过启动一个隐藏的形式,它调用你的显示的形式复制的行为,但我不建议这样做,因为你可能让你的应用程序到一个状态没有明显的UI,但进程仍在运行。

You could replicate the behavior by starting a hidden form which calls your displayable form but I don't recommend it since you risk getting your application into a state where there is no visible UI but the process is still running.