0

I'm using EnumDisplaySettings to try to get all the resolutions supported by the user's monitor, but users with ultrawide monitors are reporting that the native resolution is not being listed.

(The code is using some Unreal-specific containers but this should work on any Windows setup)

TArray<FIntPoint> GetResolutionsForDisplayDevice( DISPLAY_DEVICE& dd )
{
    TArray<FIntPoint> resolutions;
    DEVMODE dm = { 0 };
    dm.dmSize = sizeof( DEVMODE );
    dm.dmDriverExtra = 0;
    for ( uint32 i = 0; EnumDisplaySettings( dd.DeviceName, i, &dm ) != 0; i++ )
    {
        resolutions.AddUnique( FIntPoint( dm.dmPelsWidth, dm.dmPelsHeight ) );
    }
    return resolutions;
}

For example this code when run on a computer with one monitor, with a native resolution of 5120x1440, it lists a bunch of resolutions but the largest one is 3840x1080.

benui
  • 6,440
  • 5
  • 34
  • 49
  • Can be that such users have multiple different monitors. I have observed that lot of programs are somehow quite confused in such a common situation. – Öö Tiib Jul 12 '21 at 22:21
  • In this case the user does have multiple monitors, but *both* of them return 3840x1080 max resolution, when one is ultra-wide and has a native resolution of 5120x1440. Windows Display Settings correctly detects the native resolution of 5120x1440, so there must be *some* code somewhere that can get the correct resolution. – benui Jul 13 '21 at 17:24
  • But your question said "one monitor" so it strongly indicates that something in your program is wrong. – Öö Tiib Jul 13 '21 at 20:37

0 Answers0