I need to change the screen resolution on XP machines using C# .NET 3.5 when a certain program launches. I don't need to "GET" anything such as available resolution settings, primary monitor, etc. This is all in house projects with the same machines and same software.
I have Googled this extensively. Some of the code I am reading is way too much. The code that is perfect is attached but I can't get it to work. It compiles and runs just fine without errors but doesn't change the resolution.
If someone could look at the attached code or offer a simple solution I would appreciate it very much.
Thanks in advance for your help.
proc.StartInfo.Arguments = "/x 800 /y 600"; // this will change the screen resolution to
static void Main()
Screen scr = Screen.PrimaryScreen;
int oldWidth = scr.Bounds.Width;
int oldHeight = scr.Bounds.Height;
Process proc = new Process();
proc.StartInfo.FileName = @"c:\qres\ApplicationName.exe"; // put full path in here
proc.StartInfo.Arguments = "/x 800 /y 600"; // say
Console.WriteLine("Press enter to change back to original resolution and exit program");
proc.StartInfo.Arguments = "/x " + oldWidth.ToString() + "/y "+ oldHeight.ToString();