You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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:
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:
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):
Activity
falahati commentedon Feb 19, 2019
Hey Steven,
First, you need to create an array of
PathInfoinstances for the configurations you want. Keep in mind that eachPathInforepresents a logical display and each contains one or more physical displays that are configured and recognized by aPathTargetInfoinstance (accessible from thePathInfo.TargetsInfoproperty 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
PathInfofor each logical display and configured its properties including all physical displays represented byPathTargetInfoinstances, you need to ask NVidia Driver to try to apply this configuration by callingPathInfo.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
PathInfoclass (with the same name) and thePathTargetInfoclass (namedPathTargetDisplay), the only significant difference is a specific class for logical displays namedPathSourceDisplayand thereforePathInfoacts as of a connection between onePathSourceDisplayand multiplePathTargetDisplays.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
agentblythe commentedon Feb 20, 2019
Wow thanks for the detailed reply. I will try those suggestions asap. You have a great set of tools here. 👍