1

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?

Corey Ogburn
  • 24,072
  • 31
  • 113
  • 188

3 Answers3

2

see if this will help...

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

Community
  • 1
  • 1
Ryan Alford
  • 7,514
  • 6
  • 42
  • 56
2

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;
    }
}
Nathan Taylor
  • 24,423
  • 19
  • 99
  • 156
  • This does not seem to work. After adding that code, when I call the Show method, it says invalid parameters. The problem seems to be when you set cp.ExStyle, I commented that line out and the program ran, even though the window was still visible in Alt+Tab – Corey Ogburn Oct 08 '09 at 18:52
  • Well bummer! Sorry about that. :( – Nathan Taylor Oct 08 '09 at 19:40
2

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.

James
  • 80,725
  • 18
  • 167
  • 237
  • This does not work. I just tried it with Windows Forms and WPF, and both times the window still showed up in the ALT+TAB view. – Ryan Alford Oct 08 '09 at 15:20
  • 1
    I assume you haven't set "ShowInTaskbar" to false? – James Oct 08 '09 at 15:22
  • The OP had already done this hence why I never mentioned it, updated though for clarity. – James Oct 08 '09 at 15:22
  • Yes, I did not set the ShowInTaskbar to false. After setting it to false, it does work. Much better option than doing the Windows API calls. – Ryan Alford Oct 08 '09 at 15:34
  • In addition to the fact it doesn't work, I already have my FormBorderStyle set to None, so this approach cannot be taken. The window is customed designed with images and is actually made to look like an extension to a parent window (which I also don't want to show up in Alt+Tab). – Corey Ogburn Oct 08 '09 at 18:55
  • @Corey, it would have helped if you explained this in your question....if that is the case you will have to use the Windows API calls to do this. – James Oct 09 '09 at 07:44
  • setting "ShowInTaskbar" to false when using the "None" in FormBorderstyle doesn't work. I am using Windows 8 and I believe this is already tested in Windows 7. – Jayson Ragasa Jan 17 '13 at 20:23