9

I have a program that opens multiple windows. I have used this method to hide them from ALT+TAB. Now I need the new windows to stop showing up in the 'tasks' tab of task manager.

I don't need the process not to show up in task manager, I just don't want all the windows my program opens to show up in the 'task' tab.

Here is a picture of what I'm trying to get rid of: http://i1096.photobucket.com/albums/g324/thezaza101/Tasklist.jpg

-Thanks

zaza
  • 892
  • 1
  • 18
  • 37

4 Answers4

8

Solved thanks to David Heffernan.

On my main window i added a static window field which references my main window.

public static Window main;
Public MainWindow()
{
main = this;
}

On the windows I need to hide from task manager and ALT+TAB, I made my main window its owner:

public HiddenWindow()
{
this.Owner = MainWindow.main;
}  

Its really simple, it hides the window from the 'tasks' tab on task manager and also stop people from ALT+TABing into your program.

zaza
  • 892
  • 1
  • 18
  • 37
4

Another way is to use WindowInteropHelper.

    public MainWindow()
    {
        InitializeComponent();

        SourceInitialized += (s, e) =>
        {
            var win = new WindowInteropHelper(this);
            win.Owner = GetDesktopWindow();
        };
    }

    [DllImport("user32.dll", SetLastError = false)]
    static extern IntPtr GetDesktopWindow();
lindexi
  • 4,182
  • 3
  • 19
  • 65
4

For WPF the only way I currently know of is to set your window's title to string.Empty or set WindowStyle to ToolWindow. Setting ShowInTaskBar to false does not hide your window from the applications list.

David Anderson
  • 13,558
  • 5
  • 50
  • 76
0

I hvae the same problem(may some different), here is my code:

subWindow.hide();//this will hide the subWindow
subWindow.show();//if want to show again

you will not see window in task or AlT+TAB after use hide()

chengzi
  • 170
  • 2
  • 10