UlteriusServer.Api.Win32.Display.ChangeResolution C# (CSharp) Method

ChangeResolution() public static method

public static ChangeResolution ( string deviceName, int width, int height, int bbp, int freq ) : string
deviceName string
width int
height int
bbp int
freq int
return string
        public static string ChangeResolution(string deviceName, int width, int height, int bbp, int freq)
        {
            var originalMode = new Devmode();
            originalMode.dmSize = (short) Marshal.SizeOf(originalMode);
            EnumDisplaySettings(deviceName, ENUM_CURRENT_SETTINGS, ref originalMode);
            var newMode = originalMode;
            newMode.dmDeviceName = deviceName;
            newMode.dmPelsWidth = width;
            newMode.dmPelsHeight = height;
            newMode.dmBitsPerPel = bbp;
            newMode.dmDisplayFrequency = freq;
            return GetMessageForCode(ChangeDisplaySettingsEx(deviceName, ref newMode, IntPtr.Zero,
                ChangeDisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero));
        }