5

As I am using a laptop with a tv as its second monitor I want to make a little script which will trigger screen settings from extended to clone and when it is set to clone it should set the screen settings to extended. I want to make it in c# as it is my primary language and I think it could solve my problem.

So i have made a console application like this for now:

class Program
{
    static void Main(string[] args)
    {
        DisplayChanger.Start();
    }

    private static Process DisplayChanger = new Process
    {
        StartInfo =
        {
            CreateNoWindow = true,
            WindowStyle = ProcessWindowStyle.Hidden,
            FileName = "DisplaySwitch.exe",
            Arguments = "/extend"
        }
    };
}

It works fine creating a new process. But my question is, how can I check what status the "displays" have? I need that so i can run a test to see what process to start.

Thank you for your help :)

Deanna
  • 23,876
  • 7
  • 71
  • 156
chrs
  • 5,906
  • 10
  • 43
  • 74
  • 1
    Is this a programming exercise, or are you just trying to solve the issue? If you just want a solution, I've dealt with this two ways: 1) If you are using Win7, the Windows Key-P combo does just this. 2) I have an AutoHotkey script (that I cribbed from somewhere else) from back in the days of Win XP – Rob H Jan 23 '12 at 14:59
  • Programming exercise is not the word for this. I'm just trying to make a task simpler than it is right now, by having a program in the desktop i can just open to extend the screen if it is set to dual and vice verca – chrs Jan 23 '12 at 19:19
  • C# solution here https://stackoverflow.com/a/2462742/1265105 – oo_dev Jul 31 '19 at 13:56

1 Answers1

2

Not a programming solution, but you should check out DisplayFusion. It provides either shortcuts or hotkeys to change display settings for multiple monitors plus gives you tons of other features essential for working with multiple monitors.

enter image description here

UltraMon does this too, but isn't updated nearly as much. I used to use UltraMon for years but more recently switched to DisplayFusion.

Samuel Neff
  • 73,278
  • 17
  • 138
  • 182