From be6932d46ef85b27a70de4e326f2de9a5acfac2b Mon Sep 17 00:00:00 2001 From: hawkeye Date: Thu, 7 Oct 2021 09:40:21 -0400 Subject: [PATCH] Version 2.0.1 --- MSFSPopoutPanelManager.csproj | 2 +- Modules/PanelAnalysisModule.cs | 19 +++++++++---------- Modules/WindowManager.cs | 9 --------- VERSION.md | 2 ++ 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/MSFSPopoutPanelManager.csproj b/MSFSPopoutPanelManager.csproj index 10b249e..3a80810 100644 --- a/MSFSPopoutPanelManager.csproj +++ b/MSFSPopoutPanelManager.csproj @@ -5,7 +5,7 @@ net5.0-windows true x64 - 2.0 + 2.0.1 MSFSPopoutPanelManager MSFSPopoutPanelManager WindowManager.ico diff --git a/Modules/PanelAnalysisModule.cs b/Modules/PanelAnalysisModule.cs index 382ba85..5c567c9 100644 --- a/Modules/PanelAnalysisModule.cs +++ b/Modules/PanelAnalysisModule.cs @@ -28,7 +28,7 @@ namespace MSFSPopoutPanelManager var processZero = GetProcessZero(); // Move process zero childs back into simulator process - MoveChildWindowsIntoSimulatorPrcess(simulatorProcess, processZero); + MoveChildWindowsIntoSimulatorProcess(simulatorProcess, processZero); if (simulatorProcess.ChildWindows.Count > 0) { @@ -49,7 +49,7 @@ namespace MSFSPopoutPanelManager // Now all newly pop out windows are in process zero, move them into flight simulator process processZero = GetProcessZero(); - MoveChildWindowsIntoSimulatorPrcess(simulatorProcess, processZero); + MoveChildWindowsIntoSimulatorProcess(simulatorProcess, processZero); // Analyze the content of the pop out panels AnalyzePopoutWindows(simulatorProcess, profileId); @@ -136,7 +136,7 @@ namespace MSFSPopoutPanelManager return String.IsNullOrEmpty(title.ToString()) ? null : title.ToString(); } - private void MoveChildWindowsIntoSimulatorPrcess(WindowProcess simulatorProcess, WindowProcess processZero) + private void MoveChildWindowsIntoSimulatorProcess(WindowProcess simulatorProcess, WindowProcess processZero) { // The popout windows such as PFD and MFD attached itself to main window for Process ID zero instead of the MSFS process. // Moving these windows back into MSFS main window @@ -238,14 +238,13 @@ namespace MSFSPopoutPanelManager var rect = new Rect(); PInvoke.GetClientRect(windowHandle, out rect); - switch (rect.Right) + switch (rect.Bottom) { - case 1920: + case 1080: return FlightSimResolution.HD; - case 2560: - case 3440: + case 1440: return FlightSimResolution.QHD; - case 3840: + case 2160: return FlightSimResolution.UHD; default: return FlightSimResolution.QHD; @@ -327,9 +326,9 @@ namespace MSFSPopoutPanelManager var point = new Point { X = x, Y = y }; Cursor.Position = new Point(point.X, point.Y); - PInvoke.mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0); + PInvoke.mouse_event(MOUSEEVENTF_LEFTDOWN, point.X, point.Y, 0, 0); Thread.Sleep(200); - PInvoke.mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0); + PInvoke.mouse_event(MOUSEEVENTF_LEFTUP, point.X, point.Y, 0, 0); } private void AnalyzePopoutWindows(WindowProcess simulatorProcess, int profileId) diff --git a/Modules/WindowManager.cs b/Modules/WindowManager.cs index 63b476e..1e8e017 100644 --- a/Modules/WindowManager.cs +++ b/Modules/WindowManager.cs @@ -42,17 +42,8 @@ namespace MSFSPopoutPanelManager const uint KEYEVENTF_KEYUP = 0x2; const uint VK_RMENU = 0xA5; // Right Alternate key - //const int WM_LBUTTONDOWN = 0x201; - //const int WM_LBUTTONUP = 0x202; - foreach (var coor in screenCoordinates) { - //PInvoke.keybd_event(Convert.ToByte(VK_RMENU), 0, KEYEVENTF_EXTENDEDKEY, 0); - //PInvoke.SendMessage(simulatorHandle, WM_LBUTTONDOWN, 1, CreateLParam(coor.X, coor.Y)); - //Thread.Sleep(200); - //PInvoke.SendMessage(simulatorHandle, WM_LBUTTONUP, 0, CreateLParam(coor.X, coor.Y)); - //PInvoke.keybd_event(Convert.ToByte(VK_RMENU), 0, KEYEVENTF_KEYUP, 0); - // Move the cursor to the flight simulator screen then move the cursor into position PInvoke.SetCursorPos(0, 0); PInvoke.SetCursorPos(coor.X, coor.Y); diff --git a/VERSION.md b/VERSION.md index 712a23b..c28d006 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1,5 +1,7 @@ # Version History
+## Vesion 2.0.1.0 +* Change how screen resolution is detected. Used vertical instead of horizontal resolution to account for ultra wide monitors. ## Version 2.0.0.0 * Used new image recognition instead of OCR technology to determine pop outs.