Tuesday, May 15, 2012

Programmatically Moving Displays/Monitors

Matthew van Eerde's web log - Programmatically rearranging displays

Most of my test machines and my laptop have a single display; but I have two dev machines which are each connected to two displays.

When I clean install Windows, I sometimes need to rearrange the displays:

Since I clean install Windows frequently, I wrote myself a little C++ app which does this programmatically using EnumDisplayDevices / EnumDisplaySettings / ChangeDisplaySettingsEx.

Source and binaries attached.



I've been wondering how hard a utility like this would be to write. My monitor setup is different between work and home and often have to tweak/re-arrange the setup. So I've been thinking of maybe writing a utility that detects my location and offers to fix up my monitor placement. Not sure when I'll able to to actually write this, but I wanted to grab this post as it looks like a great starting point (at least to point-out the API's I'm going to have to P/Invoke, etc)

No comments: