Пример #1
0
 static void Main(string[] args)
 {
     if (args.Length >= 2 &&
         int.TryParse(args[0], out int tempWidth) && int.TryParse(args[1], out int tempHeight))
     {
         DEVMODE1 dm = new DEVMODE1();
         dm.dmDeviceName = new String(new char[32]);
         dm.dmFormName   = new String(new char[32]);
         dm.dmSize       = (short)Marshal.SizeOf(dm);
         if (User_32.EnumDisplaySettings(null, User_32.ENUM_CURRENT_SETTINGS, ref dm) != 0)
         {
             dm.dmPelsWidth  = tempWidth;
             dm.dmPelsHeight = tempHeight;
             int ret = User_32.ChangeDisplaySettings(ref dm, User_32.CDS_TEST);
             if (ret != User_32.DISP_CHANGE_FAILED)
             {
                 User_32.ChangeDisplaySettings(ref dm, User_32.CDS_UPDATEREGISTRY);
             }
         }
     }
 }
Пример #2
0
 public static extern int ChangeDisplaySettings(ref DEVMODE1 devMode, int flags);
Пример #3
0
 public static extern int EnumDisplaySettings(string deviceName, int modeNum, ref DEVMODE1 devMode);