2

Hi I am trying to hide a WPF application from Task Manager.

I use the code below. It works great in Windows Forms, but when I implement it into WPF it gave me this error: "CustomWindowStyle.MainWindow.CreateParams': no suitable method found to override"

Code:

protected override CreateParams CreateParams // <---- here is the error
{
    get
    {
        var cp = base.CreateParams;
        cp.ExStyle |= 0x80;  // Turn on WS_EX_TOOLWINDOW
        return cp;
    }
}

What I must to change in code to work?

1 Answers1

2

This answer is a quite detailed description how you can set WS_EX_TOOLWINDOW in WPF

PS: This hides your window from Alt-Tab, just like your original code did. I'm not sure whether it is possible (or even desirable) to hide it completely from Task Manager.

Community
  • 1
  • 1
Stephan Bauer
  • 9,120
  • 5
  • 36
  • 58