private static void changeResolution(int X, int Y) { DEVMODE dm = new DEVMODE(); dm.dmDeviceName = new String(new char[32]); dm.dmFormName = new String(new char[32]); dm.dmSize = (short)Marshal.SizeOf(dm); User32.EnumDisplaySettings(null, User32.ENUM_CURRENT_SETTINGS, ref dm); dm.dmPelsWidth = X; dm.dmPelsHeight = Y; User32.ChangeDisplaySettings(ref dm, User32.CDS_UPDATEREGSITRY); }
public static extern int EnumDisplaySettings(string deviceName, int modeNum, ref DEVMODE devMode);
public static extern int ChangeDisplaySettings(ref DEVMODE devMode, int flags);