Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically change screen resolution?

Is there a way to programmatically change the screen resolution or enable/disable multiple monitors in Windows XP? For example to change from 1024x768 with one monitor to 1280x1024 on two monitors? I would be most interested in a win32 function to do this but anything that can be tied to a windows shortcut would suffice.

like image 699
jacobsee Avatar asked Oct 18 '08 18:10

jacobsee


2 Answers

You can use EnumDisplayDevices to figure out what displays you have available and EnumDisplaySettings to get a list of available resolutions for your displays. Use ChangeDisplaySettings to set the resolution you need.

like image 144
Ferruccio Avatar answered Oct 15 '22 18:10

Ferruccio


Yes, but its not part of .NET. You will need to use, invoke or write a wrapper to access the Win32 API.

See ChangeDisplaySettings and related function.

Here you can find a basic example.

like image 44
Christian C. Salvadó Avatar answered Oct 15 '22 19:10

Christian C. Salvadó