Skip to content

Setting Position and Resolution of Screens #8

Closed

Description

@agentblythe

Amazing application, just the thing I was looking for!

Any chance you could provide an example of setting of properties within your sample code, at the moment, there is only getting of properties.

I want to change the resolution and/or positions of screens dynamically within a 3 screen system and wondered if this would be possible using this wrapper.

I've tried modifying properties, e.g. IsGDIPrimary, Position, Resolution within the PathInfo class however I'm not seeing any effect.

Many thanks again for the fantastic app.

S

Activity

  1. falahati commented on Feb 19, 2019

    @falahati
    Owner

    Hey Steven,

    First, you need to create an array of PathInfo instances for the configurations you want. Keep in mind that each PathInfo represents a logical display and each contains one or more physical displays that are configured and recognized by a PathTargetInfo instance (accessible from the PathInfo.TargetsInfo property as an array) - these physical displays are cloned and all going to show the same output as they all representations of one logical display.

    After creating a PathInfo for each logical display and configured its properties including all physical displays represented by PathTargetInfo instances, you need to ask NVidia Driver to try to apply this configuration by calling PathInfo.SetDisplaysConfig() static method. This is because if every change happens instantly, you can't apply major changes to the display profile unless you manually take each display out and then in again which is not convenient; so, instead, you change all settings and apply it once.

    You can also take the currently active configuration using the PathInfo.GetDisplaysConfig() static method and change it to your likings and then apply it.

    To change the display profile, however, I don't actually recommend using this library as it is limited to NVidia GPUs, following repo contains the code that allows you to easily change display settings for any brand of GPU using Windows API:

    https://github.com/falahati/WindowsDisplayAPI/

    API is very similar to this, you are still going to have the PathInfo class (with the same name) and the PathTargetInfo class (named PathTargetDisplay), the only significant difference is a specific class for logical displays named PathSourceDisplay and therefore PathInfo acts as of a connection between one PathSourceDisplay and multiple PathTargetDisplays.

    One of the goodies provided by the WindowsDisplayAPI library is the fact that it can give you supported resolutions for a display device. As far as I remember this isn't the case with this library and to get this information you need to extract them from the Display EDID. If you want to follow this path tho, you can use the following library:

    https://github.com/falahati/EDIDParser

    You can also check the source code of the following program as a better and more complete sample (comparing to the sample project included in this repo) for all mentioned libraries above as well as this one (in fact all these project are created so I can make this app):

    https://github.com/falahati/HeliosDisplayManagement

  2. agentblythe commented on Feb 20, 2019

    @agentblythe
    Author

    Wow thanks for the detailed reply. I will try those suggestions asap. You have a great set of tools here. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions