Search code examples
c#windowborderlessalt-tab

Prevent window from showing in alt tab


I am working on a program where I don't want a window to show in alt tab menu. However I need the window style to be borderless. All the solutions I have found say to change the border to tool but that won't work when I need the window to be borderless. Anyone have ideas?


Solution

  • I followed the link, had to scroll down. The answer is to use this code on the forms class:

    protected override CreateParams CreateParams
    {
        get
        {
            CreateParams cp = base.CreateParams;
            // turn on WS_EX_TOOLWINDOW style bit
            cp.ExStyle |= 0x80;
            return cp;
        }
    }
    

    Also see this link for more info.