How to hide form from Alt-Tab dialog

Hi,

I'm creating a borderless form by setting this.FormBorderStyle = FormBorderStyle.None

When I show the form, if users press Alt-Tab to switch among applications, they can still see it. How can I disable it

Thanks a lot.


Answer this question

How to hide form from Alt-Tab dialog

  • Mongsreturn

    Do I dare ask
    a) why
    and b) what FormBorderStyle has to do whether the application shows up in the Alt tab window
    The property ShowInTaskbar  would have a greater possibility of controlling whether the application shows inthe Alt-Tab menu long before a borderstyle does.


  • Tom B

    I believe The reason that it shows in the taskbar is because of a trick that .NET uses to do the SysTray. I've noticed that if you set the show in taskbar to false and set the formborder to toolbar then it will not show up in the taskbar - I do not know whether this would override the hidden form that may be used for the systray icon.
  • greatway

    Thanks, much better way of doing this, as it does not actually appear to change the borderstyle (GUI) of my borderless form, which would have been undesirable.

  • b4

    This trick works perfectly!!! Thanks a lot!

  • John Knoop

    Paste this code into your borderless form:

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



  • AdamB78

    Isn't this just another way of setting the form border style It works, but does change the border for me.


  • eyaler1

    This is how you can remove, your application icon from the ALT + TAB menu.

    From what I can gather the ALT + TAB menu displays all windows owned by the desktop or whose owners are null. There are 2 ways that you can easily stop your main form from displaying under this menu.

    1) Change the border style of the main window to Fixed or Sizable tool windows.

    I dont like this approach but it also works ....

    2) In the main forms constructor: add this line of code

    this.Owner = new Form();

    Why would you want to do this For stealth applications such as screen readers, markers and tray applications. In the case of a screen reader the main form is visible and the top most window at all times. (meaning you cannot escape it other than closing it) So although ms provides the property that says: ShowInTaskBar ... this unfortunatly only does half of the job. (if one thinks about it, it does not make sence to have these applications show under the alt tab menu.)

    If anyone knows of another way (WIN32 call possibly) please let me know.

    Thanks



  • pjc955

    I need the same thing. Does anyone have a suggestion for this. The reason I need this is it is a lightweight application that runs in the systray with no UI. It's function is just kick off other application on certain events firing. Alt-tab shows it as something you can switch to, but there isn't a visible form available, so it looks like the form wouldn't open up, when in reality, it is open, just invisible. ShowInTaskbar=false does not keep it from showing up in alt-tab dialog.
  • Vaibhav Kumar

    The overridden CreateParams trick still work! Quite useful - just wish it was higher in the search results.

  • Romantic_touch

    If your app runs in the systray, you shouldnt have any open forms. If there are no open forms, your app wont show up in Alt-tab. (You cant just hide a form, you have to close it).

  • How to hide form from Alt-Tab dialog