setting ShowInTaskBar to 'false at run-time : strange errors, crashes


B

Bill Woodruff

..NET 2.0, Visual Studio 2005

Hi,

I have several open windows, all instances of the same form template created
dynamically in response to a user action at run-time.

A user option for the application is to show all open windows in the task
bar, or only the current
active window.

I thought I could write handlers for the Form_Activated and Form_Deactivate
events of all these instances of a form_template, but I'm running into
strange errors when I set 'ShowInTaskBar to false in the 'Deactivate event
like : "can't create window handle," or "callback on a delegate that has
been garbage collected."

At first I thought these error might be related to deisgn mode, but they
persist when I run the .exe file, giving an error dialogue that does not
provide the usual debugging information.

Googling on "microsoft: showintaskbar" led to several reports that suggest
errors with setting showintaskbar to false at runtime. Francisco Balena at :

http://www.devx.com/vb2themax/Tip/18334

Says the property is read-only at run-time, but in another part of my
application I have a menu that toggles showing all, or only the active form,
in the taskbar : this code loops through a collection of open forms I
maintain and sets showintaskbar properly and with no errors !

I am aware that winforms does some strange stuff when you set ShowInTaskBar
to 'false :

"After doing some research, I found that
setting Form.ShowInTaskbar=false will close window's WS_EX_APPWINDOW flag,
and set window's owner form to WindowsFormsParkingWindow, which is an
invisible toplevel window(internal )" comments Jeffrey Tan from Microsoft at
:

http://www.dotnet247.com/247reference/msgs/57/285697.aspx

Okay my questions :

1. is switching a window's ShowInTaskBar status something that will require
use of Interop and API's in .NET 2.0 ?

2. has there been a change in versions of .NET > 2.0 that make this possible
without use of API's.

In this particular design scenario there is no one window which is always
necessarily visible, no "master form." Each winform created has its Parent
property set to Null. And, yes, Form_Closing events are modified to detect
need to terminate the app because, in this case I am using Application.Run()
after an initial template form is shown.

thanks, Bill
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top