How to detect duplicated monitors as separate screens

前端 未结 2 802
隐瞒了意图╮
隐瞒了意图╮ 2021-01-19 15:01

Using the answer in this question I can get the \"screen\" count. However, this doesn\'t seem to work with monitors that are set to \"duplicate\" (one monitor is reported in

2条回答
  •  醉酒成梦
    2021-01-19 15:37

    See This question and use the provided (and fixed in the answer) wrapper for QueryDisplayConfig.

    change the signature of the import to have out DisplayConfigTopologyId topology as the last parameter.

    Use the QueryDisplayFlags.DatabaseCurrent for the display flags, otherwise you'll get status 87 (invalid parameter)

    After calling QueryDisplayFlags the topology will be Clone, Extend etc.

    call the method...

    var status = CCDWrapper.QueryDisplayConfig(
        CCDWrapper.QueryDisplayFlags.DatabaseCurrent,
        ref numPathArrayElements, pathInfoArray, ref numModeInfoArrayElements,
        modeInfoArray, out currentTopologyId);
    

    In my tests numPathArrayElements always came back as the number of monitors currently In Use. If I changed it to "Show Only Screen 1", It said 1 screen, topology internal. "Show Only Screen 2" came back with 1 screen external. "Cloned" showed 2 screens.

提交回复
热议问题