From 3ebdf3d2fe71685affb770740aa071d84ab97ed7 Mon Sep 17 00:00:00 2001 From: "Krom, Robertus" Date: Tue, 18 Feb 2020 13:38:52 +0100 Subject: [PATCH] Fixed an issue with finding the GreenshotOCRCommand when running inside Visual Studio. Fixed an issue with running on Windows 7, as it was trying to access a Windows 10 API --- GreenshotOCRCommand/GreenshotOCRCommand.csproj | 3 +++ GreenshotPlugin/Core/DpiHelper.cs | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/GreenshotOCRCommand/GreenshotOCRCommand.csproj b/GreenshotOCRCommand/GreenshotOCRCommand.csproj index b42f8871b..4267325f2 100644 --- a/GreenshotOCRCommand/GreenshotOCRCommand.csproj +++ b/GreenshotOCRCommand/GreenshotOCRCommand.csproj @@ -8,4 +8,7 @@ + + + diff --git a/GreenshotPlugin/Core/DpiHelper.cs b/GreenshotPlugin/Core/DpiHelper.cs index df947bdbb..1ca9024ab 100644 --- a/GreenshotPlugin/Core/DpiHelper.cs +++ b/GreenshotPlugin/Core/DpiHelper.cs @@ -2,13 +2,9 @@ using GreenshotPlugin.UnmanagedHelpers; using log4net; using System; -using System.Collections.Generic; using System.Diagnostics; using System.Drawing; -using System.Linq; using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; namespace GreenshotPlugin.Core { @@ -28,7 +24,7 @@ namespace GreenshotPlugin.Core /// /// Retrieve the current DPI for the UI element which is related to this DpiHandler /// - public static uint Dpi { get; private set; } = GetDpiForSystem(); + public static uint Dpi { get; private set; } = WindowsVersion.IsWindows10OrLater ? GetDpiForSystem() : DefaultScreenDpi; /// /// Calculate a DPI scale factor