-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
43 lines (38 loc) · 1.18 KB
/
Copy pathProgram.cs
File metadata and controls
43 lines (38 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace AutoVolumeControl
{
static class Program
{
private enum ProcessDpiAwareness
{
Process_DPI_Unaware = 0,
Process_System_DPI_Aware = 1,
Process_Per_Monitor_DPI_Aware = 2
}
[DllImport("Shcore.dll")]
private static extern int SetProcessDpiAwareness(ProcessDpiAwareness value);
[DllImport("user32.dll")]
private static extern bool SetProcessDPIAware();
[STAThread]
static void Main()
{
if (Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Build >= 9600)
{
int result = SetProcessDpiAwareness(ProcessDpiAwareness.Process_Per_Monitor_DPI_Aware);
if (result != 0)
{
SetProcessDPIAware();
}
}
else
{
SetProcessDPIAware();
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new VolumeControl());
}
}
}