471,066 Members | 1,313 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,066 software developers and data experts.

ShowInTaskbar Causing Blank Form/Hang

I have a winforms application that is hidden using the following code
upon prompt:

//Remove from the taskbar and also from alt+tab
this.Visible = false;
this.ShowInTaskbar = false;
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;

Upon correct DDE prompt from another application my application should
show itself in normal state with an icon in the taskbar.

this.Show();
this.Visible = true;
this.WindowState = FormWindowState.Normal;
this.Focus();
//this.ShowInTaskbar = true;
LoadFormData();

Problem: If I do not comment out this.ShowInTaskbar = true when
re-opening my form just hangs. I cannot even access maximize or
minimize buttons. If I comment out this.ShowInTaskbar everything seems
to work correctly EXCEPT there is nothing in the taskbar. I have tried
changing the order of the calls for a show but nothing seems to help.

Any suggestions on what might be occurring and how to resolve it would
be accepted with relish!

Mike

Apr 27 '06 #1
4 2615
All,

I commented out this.ShowInTaskbar in both the hide and show sections
and the application appears to behave correctly now. I might add that
I also had to use the bugfix here
http://support.microsoft.com/default...B;EN-US;327154 to
correct my toolbar problem. I believe there may have been some
interaction between these two issues that caused the problem.

Mike

Apr 27 '06 #2
On 27 Apr 2006 12:42:45 -0700, Mike wrote:
I have a winforms application that is hidden using the following code
upon prompt: [...] Upon correct DDE prompt from another application my application should
show itself in normal state with an icon in the taskbar. [...] Problem: If I do not comment out this.ShowInTaskbar = true when
re-opening my form just hangs. I cannot even access maximize or
minimize buttons. If I comment out this.ShowInTaskbar everything seems
to work correctly EXCEPT there is nothing in the taskbar. I have tried
changing the order of the calls for a show but nothing seems to help.


Just an idea out of the blue: are you sure that both the code that hide
your form and the one that shows your form again are executed in the UI
thread of your application?
Apr 28 '06 #3
Hi Mehdi,

No, I'm not sure. How would you advise I check? Thanks much.

Mike

Apr 28 '06 #4
On 28 Apr 2006 10:39:36 -0700, Mike wrote:
No, I'm not sure. How would you advise I check? Thanks much.


The easiest way to check that is to check the value of the InvokeRequired
property of your form. If it returns false, this means that you are in the
UI thread and that you can safely call its methods.

If it returns true however this means that you are not in the UI thread and
that, as stated in the documentation, you should first marshall the call to
the UI thread using the Control.Invoke or Control.BeginInvoke methods
before accessing any method or property of a UI control.
Apr 28 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Claire | last post: by
reply views Thread by Grant Schenck | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.