Question Hide form from alt tab

Zexor

Well-known member
Joined
Nov 28, 2008
Messages
520
Programming Experience
3-5
How can i hide a borderless form from alt tab? Right now i have 3 borderless form in my app and i want all of them to be visible on screen but only 1 form listed in alt tab.
 
Last edited:
found answer

ive found the answer and just want to share it. adding this to the form will hide it.:D
VB.NET:
    Protected Overrides ReadOnly Property CreateParams() As CreateParams
        Get
            Dim cp As CreateParams = MyBase.CreateParams
            If Not Me.DesignMode Then cp.ExStyle = cp.ExStyle Or &H80
            Return cp
        End Get
    End Property
 
When using Win32 API it is usually beneficial to use the defined constants and not hard to read value numbers. &H80 is the value for constant WS_EX_TOOLWINDOW (see CreateWindowEx function help):
VB.NET:
Const WS_EX_TOOLWINDOW As Int32 = &H80I
Doesn't "ToolWindow" sound familiar? Yes, this is two of the styles you can select for FormBorderStyle property of the form in Designer, so you don't need any code to set this style.
 
Tool window

but if i set the borderstyle to toolwindow, the window will not be borderless. If i set the borderstyle to none and add the above code to it, it will stay borderless and hide from alt tab.
 
You're right, I replied to the misuse of API constant values and then just thought about the other option for tool window, scrolled right passed first post where you said the form was borderless a few times :)
 
Back
Top