Reputation:
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?
Upvotes: 2
Views: 2854
Reputation: 9249
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.
Upvotes: 2