是否有可能隐藏的winform在任务管理器的应用程序选项卡?有可能、选项卡、应用程序、任务管理器

2023-09-02 01:48:16 作者:慢热不讨喜

我正在写一个透明的WinForms应用程序,我想从显示在任务管理器的应用程序选项卡中隐藏的应用程序。我与事实确认,将在进程显示(其实它应该)。 如果我设置:

  this.ShowInTaskbar = FALSE;
 

它只是隐藏任务栏。

全部codeI有我也有一个计时器从标签制作

 公共Form1中()
    {
        的InitializeComponent();
        this.BackColor = Color.LimeGreen;
        this.TransparencyKey = Color.LimeGreen;
        定时时间=新的Timer();
        time.Interval = 1000;
        time.Tick + =新的EventHandler(time_Tick);
        time.Start();
        this.ShowInTaskbar = FALSE;


    }

    无效time_Tick(对象发件人,EventArgs的)
    {
        label1_hour.Text = DateTime.Now.Hour.ToString();
        label_minute.Text = DateTime.Now.Minute.ToString();
        label_second.Text = DateTime.Now.Second.ToString();
    }
 

解决方案

尝试像这样

 公共部分Form1类:表格{
    公共Form1中(){
        的InitializeComponent();
        this.FormBorderStyle = FormBorderStyle.None;
        this.ShowInTaskbar = FALSE;
    }
    保护覆盖的CreateParams的CreateParams {
        得到 {
            变种CP = base.CreateParams;
            cp.ExStyle | = 0x80的; //开启WS_EX_TOOLWINDOW
            返回CP;
        }
    }
}
 
我电脑的任务管理器里为什么有个我没有的应用程序

I'm writing a transparent WinForms app and I want to hide the app from showing in Task Manager's applications tab. I'm OK with the fact that it will show in Processes (in fact it should). If I set:

this.ShowInTaskbar = false;

it only hides from taskbar.

Full code i have i have a timer made from labels

        public Form1()
    {
        InitializeComponent();
        this.BackColor = Color.LimeGreen;
        this.TransparencyKey = Color.LimeGreen;
        Timer time = new Timer();
        time.Interval = 1000;
        time.Tick += new EventHandler(time_Tick);
        time.Start();
        this.ShowInTaskbar = false;


    }

    void time_Tick(object sender, EventArgs e)
    {
        label1_hour.Text = DateTime.Now.Hour.ToString() ;
        label_minute.Text = DateTime.Now.Minute.ToString();
        label_second.Text = DateTime.Now.Second.ToString();
    }

解决方案

Try something like this

public partial class Form1 : Form {
    public Form1() {
        InitializeComponent();
        this.FormBorderStyle = FormBorderStyle.None;
        this.ShowInTaskbar = false;
    }
    protected override CreateParams CreateParams {
        get {
            var cp = base.CreateParams;
            cp.ExStyle |= 0x80;  // Turn on WS_EX_TOOLWINDOW
            return cp;
        }
    }
}