} public void SetWindowsAltTab(IntPtr p_WindowsIntPtr) { int _Value = GetWindowLong(p_WindowsIntPtr, (-20)); SetWindowLong(p_WindowsIntPtr, (-20), _Value | 0x00000080); } [DllImport("user32.dll", EntryPoint = "GetWindowLong")] public static extern int GetWindowLong(IntPtr hwnd, int nIndex); [DllImport("User32.dll", CharSet = CharSet.Auto)] public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
private void Form1_Load(object sender, EventArgs e)
{
SetWindowsAltTab(this.Handle);
} public void SetWindowsAltTab(IntPtr p_WindowsIntPtr)
{
int _Value = GetWindowLong(p_WindowsIntPtr, (-20));
SetWindowLong(p_WindowsIntPtr, (-20), _Value | 0x00000080); } [DllImport("user32.dll", EntryPoint = "GetWindowLong")]
public static extern int GetWindowLong(IntPtr hwnd, int nIndex); [DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
是将你的程序从工具栏中隐藏吗,那么你在做程序的时候将其设置不在工具栏中显示就可以了,那么Alt+Tab就看不到的
public Form1() {
InitializeComponent();
ShowInTaskbar = false;
this.FormBorderStyle = FormBorderStyle.SizableToolWindow; // or
//or
//this.FormBorderStyle = FormBorderStyle.FixedToolWindow;
}