#region 在Alt+Tab中使窗口不可见 // 定义用于修改窗口样式的常量 private const int GWL_EXSTYLE = -20; private const int WS_EX_TOOLWINDOW = 0x00000080; // 导入 Windows API 函数 [DllImport("user32.dll")] private static extern int GetWindowLong(IntPtr hwnd, int index); [DllImport("user32.dll")] private static extern int SetWindowLong(IntPtr hwnd, int index, int newStyle); #endregion
使用
WindowInteropHelper wndHelper = new WindowInteropHelper(this); IntPtr hwnd = wndHelper.Handle; // 获取当前窗口样式 int currentStyle = GetWindowLong(hwnd, GWL_EXSTYLE); // 设置 WS_EX_TOOLWINDOW 样式,这会使窗口在任务切换时不可见 SetWindowLong(hwnd, GWL_EXSTYLE, currentStyle | WS_EX_TOOLWINDOW);
标签:窗口,int,hwnd,private,WS,Tab,GWL,Alt,中使 From: https://www.cnblogs.com/wangjintao99/p/17777560.html