现在有个应用环境,需要在用户打开Word或Excel后,不能切换到其它界面,也就是说不能使用windows键或ALT+TAB键切换到等其它方式切换到其它界面,而且不能最小化,一直保持最大化的状态,直到用户使用word或excel本身的退出功能退出。
不知道这样的程序用C#或VC++怎样实现,希望高手指教!

解决方案 »

  1.   

    想要控制的比较严格就HOOK做一般程度的骗过可以用C#实现。
      

  2.   

    置前
    [DllImport("User32.dll ", EntryPoint = "FindWindow")]
            private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);        [DllImport("user32.dll")]
            public static extern IntPtr GetDC(IntPtr hWnd);        [DllImport("user32.dll")]
            public static extern Int32 ReleaseDC(IntPtr hWnd, IntPtr hdc);
            [DllImport("gdi32.dll")]
            public static extern uint GetPixel(IntPtr hdc, int nXPos, int nYPos);
            [DllImport("user32.dll")]
            public static extern bool SetForegroundWindow(IntPtr hWnd);
            private void button1_Click(object sender, EventArgs e)
            {
                IntPtr hWnd = FindWindow(null, "");
                IntPtr hdc = GetDC(hWnd);
                SetForegroundWindow(hWnd);        }