private bool IsMaximized(Process p)
		{
			IntPtr handle;
			if (_processesAndMaximizedWindows.ContainsKey(p.Id))
			{
				handle = _processesAndMaximizedWindows[p.Id];
			}
			else
			{
				_processesAndMaximizedWindows.Add(p.Id, p.MainWindowHandle);
				handle = p.MainWindowHandle;
			}

			var placement = new WindowPlacement();
			placement.length = Marshal.SizeOf(placement);

			if (WinAPIHelper.GetWindowPlacement(handle, ref placement))
			{
				if (placement.showCmd == 3) // WM_MAXIMIZED
				{
					_processesAndMaximizedWindows[p.Id] = handle;
					return true;
				}
			}
			else
				if (_processesAndMaximizedWindows[p.Id] != p.MainWindowHandle)
				{
					_processesAndMaximizedWindows[p.Id] = p.MainWindowHandle;
					return IsMaximized(p);
				}
				else
					return false;

			// Error retrieving the Window placement
			return false;
		}
Esempio n. 2
0
 public static extern bool GetWindowPlacement(IntPtr hWnd, ref WindowPlacement lpwndpl);
Esempio n. 3
0
		public static extern bool GetWindowPlacement(IntPtr hWnd, ref WindowPlacement lpwndpl);