Monday, December 13, 2010

Hiding the form from alt-tab menu

A UI tweak for hiding the form from alt-tab menu
Protected Overrides ReadOnly Property CreateParams As System.Windows.Forms.CreateParams
Get            Dim cp As CreateParams = MyBase.CreateParams
cp.ExStyle = cp.ExStyle Or &H80
Return cp
End Get    End Property 
In order to make it work, you have to use
Me.ShowInTaskbar = False

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

Following always works,
Me.FormBorderStyle = FormBorderStyle.SizableToolWindow
Me.ShowInTaskbar = False
But if you have 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.

1 comment :

  1. Are you trying to earn money from your traffic by popup ads?
    In case you do, did you try using PopAds?