[转]让窗体不显示在Alt+Tab中

public class MyForm : Form
{
    protected override CreateParams CreateParams
    {
        get
        {
            const int WS_EX_APPWINDOW = 0x40000; 
            const int WS_EX_TOOLWINDOW = 0x80;
            CreateParams cp = base.CreateParams;
            cp.ExStyle &= (~WS_EX_APPWINDOW);    // 不显示在TaskBar
            cp.ExStyle |= WS_EX_TOOLWINDOW;      // 不显示在Alt-Tab
            return cp;
        }
    }
}

  

posted @ 2014-09-16 16:44  安度  阅读(497)  评论(0编辑  收藏  举报