diff --git a/CenterTaskbar/DisplaySettings.cs b/CenterTaskbar/DisplaySettings.cs index dc9c936..3196aa5 100644 --- a/CenterTaskbar/DisplaySettings.cs +++ b/CenterTaskbar/DisplaySettings.cs @@ -11,13 +11,12 @@ internal static class DisplaySettings const int ENUM_CURRENT_SETTINGS = -1; const int ENUM_REGISTRY_SETTINGS = -2; - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] private struct DEVMODE { - - private const int CCHDEVICENAME = 0x20; - private const int CCHFORMNAME = 0x20; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)] + private const int CCHDEVICENAME = 32; + private const int CCHFORMNAME = 32; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = CCHDEVICENAME)] public string dmDeviceName; public short dmSpecVersion; public short dmDriverVersion; @@ -33,7 +32,7 @@ private struct DEVMODE public short dmYResolution; public short dmTTOption; public short dmCollate; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)] + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = CCHFORMNAME)] public string dmFormName; public short dmLogPixels; public int dmBitsPerPel; @@ -49,7 +48,6 @@ private struct DEVMODE public int dmReserved2; public int dmPanningWidth; public int dmPanningHeight; - } //public static void ListAllDisplayModes()