restructure project for part 2
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using Windows.Foundation;
|
||||
using Windows.Win32;
|
||||
using Windows.Win32.Foundation;
|
||||
using Windows.Win32.UI.WindowsAndMessaging;
|
||||
|
||||
namespace Hyperbar.Interop.Windows;
|
||||
|
||||
internal static class SystemInformationHelper
|
||||
{
|
||||
private const int SPI_GETWORKAREA = 48;
|
||||
|
||||
public static Rect VirtualScreen => GetVirtualScreen();
|
||||
|
||||
public static Rect WorkingArea => GetWorkingArea();
|
||||
|
||||
private static Rect GetVirtualScreen()
|
||||
{
|
||||
Size size = new(PInvoke.GetSystemMetrics(SYSTEM_METRICS_INDEX.SM_CXSCREEN),
|
||||
PInvoke.GetSystemMetrics(SYSTEM_METRICS_INDEX.SM_CYSCREEN));
|
||||
return new Rect(0, 0, size.Width, size.Height);
|
||||
}
|
||||
|
||||
private static Rect GetWorkingArea()
|
||||
{
|
||||
RECT rect = new();
|
||||
|
||||
SystemParametersInfo(SPI_GETWORKAREA, 0, ref rect, 0);
|
||||
return new Rect(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
|
||||
}
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||
private static extern bool SystemParametersInfo(int nAction, int nParam, ref RECT rc, int nUpdate);
|
||||
}
|
||||
Reference in New Issue
Block a user