RickStrahl / SetResolution

Quickly set Windows Display Resolution via Command Line
Other
136 stars 5 forks source link

Set dmFields to change width and height #3

Closed higor-correa closed 1 year ago

higor-correa commented 1 year ago

When trying to set my monitor layout to the max settings ( 3440x1440 32bits 120hz ) DisplayManagerNative.ChangeDisplaySettingsEx returns BadMode: image.

SetResolution.xml:

<?xml version="1.0" encoding="utf-8"?>
<SetResolution xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <Profiles>
      <DisplayProfile>
         <Name>Game</Name>
         <Width>1920</Width>
         <Height>1080</Height>
         <Frequency>165</Frequency>
         <BitSize>32</BitSize>
         <Orientation>Default</Orientation>
      </DisplayProfile>
      <DisplayProfile>
         <Name>Game2</Name>
         <Width>1920</Width>
         <Height>1080</Height>
         <Frequency>144</Frequency>
         <BitSize>32</BitSize>
         <Orientation>Default</Orientation>
      </DisplayProfile>
      <DisplayProfile>
         <Name>Normal</Name>
         <Width>3440</Width>
         <Height>1440</Height>
         <Frequency>120</Frequency>
         <BitSize>32</BitSize>
         <Orientation>Default</Orientation>
      </DisplayProfile>
   </Profiles>
   <MinResolutionWidth>1024</MinResolutionWidth>
</SetResolution>

I digged a bit in stackoverflow and I found this fix that worked here. I don't have any experience with this kind of library, but it fixed for me locally 😄 Hope it works for everyone.

Great tool btw!

RickStrahl commented 1 year ago

Thanks for the PR.

The change makes sense although I'm also not sure what exactly that does. Do you remember what the Stackoverflow link that you to this fix was?