Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop windows from showing up as 'tasks' from task manager WPF c#

Tags:

c#

wpf

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

like image 409
zaza Avatar asked Sep 24 '11 13:09

zaza


2 Answers

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();
like image 180
lindexi Avatar answered Oct 20 '22 04:10

lindexi


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.

like image 42
David Anderson Avatar answered Oct 20 '22 03:10

David Anderson