Question on screen resolution changing

Started by oldone1, December 03, 2013, 12:47:22 PM

Previous topic - Next topic

oldone1

I used the supplied script to obtain the available resolutions, but I added a decision as to actually doing a change or leaving it alone.  My questions are actually 2.

1.  Whenever I run my script, I  get 2 different numbers of resolutions .  The larger number is 27 more than the lower number.  I do not why this happens.  My system has 2 display adapters  Radeon X600/X550 and a Radeon X600/X550 secondary. Could this be reason for the different numbers?  I base this on my processing of the CIM_Videossetting WMI class which has 2 video controllers.  When I process just the first video controller, I get the smaller number.  When I process both controllers, I get the larger number.

2.  My second question is I think that your script is retrieving resolutions from a display adapter.  According to another site, the monitor could have a different set of allowable resolutions.  This is  true in my case.  I believe the monitors allowable resolutions are stored in something called an EDID.  There is a copy of this EDID in the registry and also someplace else.  Are you aware of any means of retrieving the resolutions from this EDID(either the registry copy or the other one whereever it is?

Deana

Quote from: oldone1 on December 03, 2013, 12:47:22 PM
I used the supplied script to obtain the available resolutions, but I added a decision as to actually doing a change or leaving it alone.  My questions are actually 2.

1.  Whenever I run my script, I  get 2 different numbers of resolutions .  The larger number is 27 more than the lower number.  I do not why this happens.  My system has 2 display adapters  Radeon X600/X550 and a Radeon X600/X550 secondary. Could this be reason for the different numbers?  I base this on my processing of the CIM_Videossetting WMI class which has 2 video controllers.  When I process just the first video controller, I get the smaller number.  When I process both controllers, I get the larger number.

You forgot to include the script. Difficult to stay what is getting returned without seeing the code. It does seem reasonable that the cause of the different values is due to the multiple display adapters.


Quote from: oldone1 on December 03, 2013, 12:47:22 PM
2.  My second question is I think that your script is retrieving resolutions from a display adapter.  According to another site, the monitor could have a different set of allowable resolutions.  This is  true in my case.  I believe the monitors allowable resolutions are stored in something called an EDID.  There is a copy of this EDID in the registry and also someplace else.  Are you aware of any means of retrieving the resolutions from this EDID(either the registry copy or the other one whereever it is?

If that data is available in the registry you could probably read it using RegQueryBin. The structure of the EDID 1.3 data format may be listed in this Wikipedia article: http://en.wikipedia.org/wiki/Extended_display_identification_data. Once you have the binary data using RegQueryBin you can use the BinaryPeek functions to extract the necessary bits of information. 
Deana F.
Technical Support
Wilson WindowWare Inc.

oldone1

Sorry about not including the code.  It was on the referenced question about  changing resolutions.

UserDll=StrCat(DirWindows(1),"USER32.DLL")
TDEVICEMODEA=BinaryAlloc(156)                      ;DEVMODE structure
;Size of TDEVICEMODEA record: 156 Bytes
;Field offsets and sizes are:
offdmDeviceName       = 0   ;32
offdmSpecVersion      = 32  ;2
offdmDriverVersion    = 34  ;2
offdmSize             = 36  ;2
offdmDriverExtra      = 38  ;2
offdmFields           = 40  ;4
offdmOrientation      = 44  ;2
offdmPaperSize        = 46  ;2
offdmPaperLength      = 48  ;2
offdmPaperWidth       = 50  ;2
offdmScale            = 52  ;2
offdmCopies           = 54  ;2
offdmDefaultSource    = 56  ;2
offdmPrintQuality     = 58  ;2
offdmColor            = 60  ;2
offdmDuplex           = 62  ;2
offdmYResolution      = 64  ;2
offdmTTOption         = 66  ;2
offdmCollate          = 68  ;2
offdmFormName         = 70  ;32
offdmLogPixels        = 102 ;2
offdmBitsPerPel       = 104 ;4
offdmPelsWidth        = 108 ;4
offdmPelsHeight       = 112 ;4
offdmDisplayFlags     = 116 ;4
offdmDisplayFrequency = 120 ;4
offdmICMMethod        = 124 ;4
offdmICMIntent        = 128 ;4
offdmMediaType        = 132 ;4
offdmDitherType       = 136 ;4
offdmICCManufacturer  = 140 ;4
offdmICCModel         = 144 ;4
offdmPanningWidth     = 148 ;4
offdmPanningHeight    = 152 ;4
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;Bool EnumDisplaySettingsA (String:lpszDeviceName,Integer:iModeNum,Pointer:lpDevMode)
;   lpszDeviceName is a pointer to the target display adapter.  Null specifies default adapter.
;   iModeNum specifies whether to query the display adapter or the registry settings for the adapter.
;   lpDevMode is a pointer to a DevMode structure to store info about the specified graphics mode.
ModeIndex=0
rescnt = 0
datx = ''
While 1
   ReturnValue=DllCall(UserDll,long:"EnumDisplaySettingsA",lpnull,long:ModeIndex,lpbinary:TDEVICEMODEA )
   If ReturnValue==0 Then Break
   dnamex=BinaryPeekStr(TDEVICEMODEA, 0, 32)
   dname=StrCat(dname,dnamex,@tab)

;   Get info on relevant display settings
   dmPelsWidth        = BinaryPeek4(TDEVICEMODEA,offdmPelsWidth)        ;Horizontal resolution
   dmPelsHeight       = BinaryPeek4(TDEVICEMODEA,offdmPelsHeight)       ;Vertical resolution
   dmBitsPerPel       = BinaryPeek4(TDEVICEMODEA,offdmBitsPerPel)       ;Color depth
   dmDisplayFrequency = BinaryPeek4(TDEVICEMODEA,offdmDisplayFrequency) ;Refresh Rate
   dmDisplayFlags     = BinaryPeek4(TDEVICEMODEA,offdmDisplayFlags)
     
   datx = StrCat(datx,dmPelsWidth,',',dmPelsHeight,',',dmBitsPerPel,',',dmDisplayFrequency, @TAB)
   rescnt = rescnt+1
    ModeIndex = ModeIndex+1
   
EndWhile


AskItemlist("Screen Resolutions %rescnt%  (width,height,bitsperpixel,frequency)",datx,@TAB,@UNSORTED,@SINGLE)
BinaryFree(TDEVICEMODEA)
:alldone
Exit