private void UpdateClientLayouts() { Process[] clientProcesses = ThumbnailManager.GetClientProcesses(); foreach (Process process in clientProcesses) { RECT rect; DwmApiNativeMethods.GetWindowRect(process.MainWindowHandle, out rect); int left = Math.Abs(rect.Left); int right = Math.Abs(rect.Right); int clientWidth = Math.Abs(left - right); int top = Math.Abs(rect.Top); int bottom = Math.Abs(rect.Bottom); int clientHeight = Math.Abs(top - bottom); ClientLayout clientLayout = new ClientLayout(); clientLayout.X = rect.Left; clientLayout.Y = rect.Top; clientLayout.Width = clientWidth; clientLayout.Height = clientHeight; this._configuration.SetClientLayout(process.MainWindowTitle, clientLayout); } }
private void ApplyClientLayout(IntPtr clientHandle, string clientTitle) { ClientLayout clientLayout = this._configuration.GetClientLayout(clientTitle); if (clientLayout == null) { return; } DwmApiNativeMethods.MoveWindow(clientHandle, clientLayout.X, clientLayout.Y, clientLayout.Width, clientLayout.Height, true); }