Let’s say I’m writing a Windows Forms (.NET Framework 3.5) application which shows the first form in the usual way:
Application.Run(new Foo());
At this point the title and icon of this application are correctly shown in the “Application” tab of the task manager and I’m happy.
Then somewhere in Foo I show a second form while hiding the first:
Bar bar = new Bar();
try
{
Visible = false;
bar.ShowDialog();
}
finally
{
Visible = true;
bar.Dispose();
}
This works as expected, but as long as Foo is hidden, the entry in the “Applications” tab of the task manager for the application also disappears. Unfortunately some users and third party tools are terribly confused by this.
Is there a way to still display the icon and name of an application in the task manager if the “main form” of the application is not visible?
An Ancient smoke-and-mirrors trick I’ve done in the past… leave the form visible, but set its LOCATION to something like top = 0, left = -5000, so it won’t be in the visible screen area