You need to call the Windows API function
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] public static extern IntPtr GetForegroundWindow();
Hwnd is the function returns a handle to the page. Use this handle can get the page attribute information, operation page.
1. Get page attribute information
[StructLayout(LayoutKind.Sequential)] public struct RECT { public int Left; // leftmost coordinate public int Top; // uppermost coordinate public int Right; // rightmost coordinate public int Bottom; // lowermost coordinate }
[DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] static extern bool GetWindowRect(IntPtr hWnd, ref RECT lpRect);
2. Operation page
[The DllImport ( " User32.dll " , the CharSet = CharSet.Auto, ExactSpelling = to true )] public static extern int the ShowWindow (IntPtr HWND, int the nCmdShow); // the nCmdShow: 1 0 Close normal size minimized window display window 2 3 maximized window