Click here to Skip to main content
15,885,149 members
Articles / Desktop Programming / Windows Forms
Tip/Trick

Hiding the form from alt-tab menu

Rate me:
Please Sign up or sign in to vote.
4.80/5 (10 votes)
19 Dec 2010CPOL 21.5K   10   2
Hiding the form from alt-tab menu
This is a UI tweak for hiding the form from alt-tab menu.

C#
protected override CreateParams CreateParams
{
   get
   {
      CreateParams cp = base.CreateParams;
      cp.ExStyle |= 0x80;
      return cp;
   }
}


Edit:
In order to make it work, you have to use Me.ShowInTaskbar = False

Description:

WS_EX_TOOLWINDOW bit is turned on by OR-ing ExStyle with 0x80.

The following always works,
C#
Me.FormBorderStyle = FormBorderStyle.SizableToolWindow;
Me.ShowInTaskbar = False;


But if you have a borderless form, i.e., FormBorderStyle.None then ShowInTaskbar = False doesn't work. So, we should set the WS_EX_TOOLWINDOW to true in addition to Me.ShowInTaskbar = False.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
India India
is a poor software developer and thinker. Presently working on a theory of "complementary perception". It's a work in progress.

Comments and Discussions

 
GeneralReason for my vote of 1 My vote of 1, to post the code that ... Pin
Prerak Patel9-Dec-10 21:23
professionalPrerak Patel9-Dec-10 21:23 
GeneralYou might mention, in a short sentence, why that works and w... Pin
Dr.Walt Fair, PE9-Dec-10 13:50
professionalDr.Walt Fair, PE9-Dec-10 13:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.