How can I change monitor settings to duplicate and extend via script

核能气质少年 提交于 2020-01-03 15:54:14

问题


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 :)


回答1:


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.

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



来源:https://stackoverflow.com/questions/8973352/how-can-i-change-monitor-settings-to-duplicate-and-extend-via-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!