Esempio n. 1
0
 private void GetActiveGameWindowInfo()
 {
     _gameWindowHwnd = AppStateSingleton.Instance().GetMainWindowHandleOfAttachedProcess();
     if (_gameWindowHwnd == IntPtr.Zero)
     {
         _currentWidthTextBox.Text  = string.Empty;
         _currentHeightTextBox.Text = string.Empty;
         _currentARTextBox.Text     = string.Empty;
         return;
     }
     Win32Wrapper.GetWindowInfo(_gameWindowHwnd, ref _gameWindowInfo);
     _currentWidthTextBox.Text  = _gameWindowInfo.rcWindow.Width.ToString();
     _currentHeightTextBox.Text = _gameWindowInfo.rcWindow.Height.ToString();
     _currentARTextBox.Text     = GeneralUtils.CalculateAspectRatio(_gameWindowInfo.rcWindow.Width, _gameWindowInfo.rcWindow.Height).ToString(appendDescription: false);
     if (_newHeightBox.Value <= 0 || _newWidthBox.Value <= 0)
     {
         //reset with current window
         _newHeightBox.Value      = _gameWindowInfo.rcWindow.Height;
         _newWidthBox.Value       = _gameWindowInfo.rcWindow.Width;
         _aspectRatioTextBox.Text = _currentARTextBox.Text;
     }
 }
Esempio n. 2
0
 private void GetActiveGameWindowInfo()
 {
     _gameWindowHwnd = AppStateSingleton.Instance().GetMainWindowHandleOfAttachedProcess();
     _currentResolutionGroupBox.Enabled = _gameWindowHwnd != IntPtr.Zero;
     if (_gameWindowHwnd == IntPtr.Zero)
     {
         _currentWidthTextBox.Text  = string.Empty;
         _currentHeightTextBox.Text = string.Empty;
         _currentARTextBox.Text     = string.Empty;
         return;
     }
     Win32Wrapper.GetWindowInfo(_gameWindowHwnd, ref _gameWindowInfo);
     _currentWidthTextBox.Text  = _gameWindowInfo.rcWindow.Width.ToString();
     _currentHeightTextBox.Text = _gameWindowInfo.rcWindow.Height.ToString();
     _currentARTextBox.Text     = CalculateAspectRatio(_gameWindowInfo.rcWindow.Width, _gameWindowInfo.rcWindow.Height).ToString();
     if (_newHeightUpDown.Value <= 0 || _newWidthUpDown.Value <= 0)
     {
         //reset with current window
         _newHeightUpDown.Value = _gameWindowInfo.rcWindow.Height;
         _newWidthUpDown.Value  = _gameWindowInfo.rcWindow.Width;
     }
 }