Skip to content

Commit c1dd816

Browse files
committed
Extracted ScreenCapture-library from ambilight project
1 parent 8e58c0b commit c1dd816

13 files changed

+791
-0
lines changed

ScreenCapture.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.31025.194
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScreenCapture", "ScreenCapture\ScreenCapture.csproj", "{90596344-E012-4534-A933-3BD1B55469DC}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{90596344-E012-4534-A933-3BD1B55469DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{90596344-E012-4534-A933-3BD1B55469DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{90596344-E012-4534-A933-3BD1B55469DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{90596344-E012-4534-A933-3BD1B55469DC}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {B5111031-6E65-4331-9E6E-A07165289860}
24+
EndGlobalSection
25+
EndGlobal

ScreenCapture.sln.DotSettings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DPI/@EntryIndexedValue">DPI</s:String>
3+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DX/@EntryIndexedValue">DX</s:String></wpf:ResourceDictionary>

ScreenCapture/DPIAwareness.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// ReSharper disable InconsistentNaming
2+
using System.Runtime.InteropServices;
3+
4+
namespace ScreenCapture
5+
{
6+
public static class DPIAwareness
7+
{
8+
[DllImport("user32.dll", SetLastError = true)]
9+
internal static extern bool SetProcessDpiAwarenessContext(int dpiFlag);
10+
11+
[DllImport("SHCore.dll", SetLastError = true)]
12+
internal static extern bool SetProcessDpiAwareness(PROCESS_DPI_AWARENESS awareness);
13+
14+
[DllImport("user32.dll")]
15+
internal static extern bool SetProcessDPIAware();
16+
17+
internal enum PROCESS_DPI_AWARENESS
18+
{
19+
Process_DPI_Unaware = 0,
20+
Process_System_DPI_Aware = 1,
21+
Process_Per_Monitor_DPI_Aware = 2
22+
}
23+
24+
internal enum DPI_AWARENESS_CONTEXT
25+
{
26+
DPI_AWARENESS_CONTEXT_UNAWARE = 16,
27+
DPI_AWARENESS_CONTEXT_SYSTEM_AWARE = 17,
28+
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE = 18,
29+
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 = 34
30+
}
31+
32+
public static void Initalize()
33+
{
34+
SetProcessDpiAwarenessContext((int)DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)