Minor fixes

This commit is contained in:
seerge
2023-03-07 21:19:04 +01:00
parent 30f678d08f
commit be133cd238
3 changed files with 14 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
using System.Diagnostics;
using System.Management;
using System.Runtime.InteropServices;
using System.Windows.Forms;
public class NativeMethods
{
@@ -258,24 +259,25 @@ public class NativeMethods
{
if ((d.StateFlags & DisplayDeviceStateFlags.AttachedToDesktop) != 0)
{
//Debug.WriteLine(d.DeviceID);
//Debug.WriteLine(d.DeviceName);
if (counter == deviceNum)
{
laptopScreen = d.DeviceName;
//Debug.WriteLine(d.DeviceID);
//Debug.WriteLine(d.DeviceName);
}
counter++;
}
}
/*
if (laptopScreen is null)
// Mismatch between active screens and enumerated screens, fallback to old method
if (counter != activeScreens.Count)
{
foreach (var screen in screens)
Debug.WriteLine(screen.DeviceName);
laptopScreen = null;
foreach (var screen in Screen.AllScreens)
if (screen.DeviceName == laptopScreenName)
laptopScreen = screen.DeviceName;
}
*/
return laptopScreen;
}