窗体在alt+tab的窗口里显示或不显示

2016/10/27 10:16:06

Category 软件技术 Tag 窗体,windowsapi

protected override CreateParams CreateParams
{
            get
            {
                const int WS_EX_APPWINDOW = 0x00040000;
                const int WS_EX_TOOLWINDOW = 0x00000080;

                CreateParams result = base.CreateParams;
                result.ExStyle = result.ExStyle & (~WS_EX_APPWINDOW);// 不显示在TaskBar 
                result.ExStyle = result.ExStyle | WS_EX_TOOLWINDOW;// 不显示在Alt-Tab 
                return result;
            }
}