Results 1 to 7 of 7

Thread: EnumDisplaySettings (API)

  1. #1

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,730

    EnumDisplaySettings (API)

    Using EnumDisplaySettings you can enumerate different display modes that your monitor can switch to.
    I have looked into the DEVMODE property but I can't find what Im looking for.

    so, what I would like to know is if theres a way to know if the monitor will "stretch" or keep the aspect ratio.
    my current monitor will stretch the screen, making a 4:3 resolution look like 16:9.
    while I know of a monitor that would change to 4:3 and keep the aspect ratio even if the monitor itself is a 16:9/10.

    so, is there a way to know this? (without the need to change to that resolution and look at it manually of course)

    or maybe theres a flag using ChangeDisplaySettings API that will keep the aspect ratio?

  2. #2
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,451

    Re: EnumDisplaySettings (API)

    On some monitors this is a menu setting on the device itself. In this case I wouldn't t think there's any way for Windows to know whether the aspect ratio has been preserved or not. There certainly wouldn't be any guarantee.

  3. #3
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,440

    Re: EnumDisplaySettings (API)

    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  4. #4

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,730

    Re: EnumDisplaySettings (API)

    yeah. I looked into the SetDisplayConfig API, but still no luck with it. will keep reading about it, as it could be a solution to do.

  5. #5

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,730

    Re: EnumDisplaySettings (API)

    the problem is that I get a invalid argument error code when I try to start it.

    the API
    Private Declare Function GetDisplayConfigBufferSizes Lib "user32" (Flags As Long, pNumPathArrayElements As Long, pNumModeInfoArrayElements As Long) As Long
    from https://docs.microsoft.com/en-us/win...figbuffersizes

    return 87 (E_INVALIDARG)
    for flags, doesn't matter what I try:
    Const QDC_ALL_PATHS As Long = &H1
    Const QDC_ONLY_ACTIVE_PATHS As Long = &H2
    Const QDC_DATABASE_CURRENT As Long = &H4

    same error for any of the 3 flags. example
    ret = GetDisplayConfigBufferSizes(QDC_ONLY_ACTIVE_PATHS, pathArraySize, modeArraySize)

    ret will return as 87 instead of 0

  6. #6
    Lively Member vbLewis's Avatar
    Join Date
    Feb 2009
    Location
    USA
    Posts
    126

    Re: EnumDisplaySettings (API)

    Use byval for flags ...

    Private Declare Function GetDisplayConfigBufferSizes Lib "user32" (Byval Flags As Long, pNumPathArrayElements As Long, pNumModeInfoArrayElements As Long) As Long

  7. #7
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,440

    Re: EnumDisplaySettings (API)

    Yup.
    ByVal for the first Parameter
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width