Corey Ogburn
Corey Ogburn

Reputation: 24717

C# Visible windows but I don't want them to show up in Alt+Tab?

I have a program I'm working that is a ticker across the bottom of the screen. All that functionality is fine, but I've noticed that when I hit Alt+Tab I see it in the list. I already have ShowInTaskbar set to false, but I don't want my program to appear in this list. Is there a property I'm forgetting about or a WinAPI call I can make to keep my app from showing up in Windows Alt+Tab?

Upvotes: 1

Views: 3339

Answers (3)

James
James

Reputation: 82096

You will have to set the window style to be a Toolbox window aswell as ShowInTaskbar to false. Just change the BorderStyle of the form to be FixedToolWindow or SizeableToolWindow. See FormBorderStyle for more details.

Upvotes: 2

Nathan Taylor
Nathan Taylor

Reputation: 24606

I haven't tested the code, but a little Googling led me to this:

private static uint WS_POPUP            = 0x80000000;
private static uint WS_EX_TOPMOST       = 0x00000008;
private static uint WS_EX_TOOLWINDOW    = 0x00000080;

protected override CreateParams CreateParams
{
    get
    {
        CreateParams cp = base.CreateParams;
        cp.Style = unchecked((int) WS_POPUP);
        cp.ExStyle = (int) WS_EX_TOPMOST + (int) WS_EX_TOOLWINDOW;

        // Set location
        cp.X = 100;
        cp.Y = 100;

        return cp;
    }
}

Upvotes: 2

Ryan Alford
Ryan Alford

Reputation: 7594

see if this will help...

Best way to hide a window from the Alt-Tab program switcher?

Upvotes: 2

Related Questions