Some people despise the “stretch”. This stretching occurs on newer screens that normally have an aspect ratio of 16:9 or 16:10 and are set to a 4:3 aspect ratio display resolution (i.e. 1024 x 768). In some cases setting the 4:3 ratio resolution is required for an antiquated application’s view ability. Setting this via a script is not a simple task, because by Default the Intel Graphic’s driver stretches the screen to fit the panel. If you are the type that hates stretching and want to maintain the aspect ratio, then this script is for you:
ForceAspectRatio.vbs contents:
Script was tested in Win 7 x64, with the Intel Graphics 4000, Driver version 10.18.10.3308.
Const cHKLM = &H80000002 Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv") Set oShell = CreateObject("WScript.Shell") sKeyPath = "SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration" oReg.EnumKey cHKLM, sKeyPath, aSubKeys If Not (isnull(aSubKeys)) Then For Each sSubkey In aSubKeys sTmpValueName = "HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration\" & sSubKey & "\00\00\Scaling" Wscript.Echo "Attempting to write 4 value to: """ & sTmpValueName & """" oShell.RegWrite sTmpValueName, 4, "REG_DWORD" If Err.Number <> 0 Then WScript.Echo "Write failed with errors: " & Err.Number Else WScript.Echo "Write succedded." End If Next End If
This block of code enumerates through all of the GraphicsDrivers configurations updating the “Scaling” DWORD value to “4”, which translates to “Maintain Aspect Ratio”. Once set, I can change the resolution via the “qres.exe” command line utility to what ever resolution I want and the aspect ratio will be maintained.
cscript "%~dp0ForceAspectRatio.vbs" start /w "" "%~dp0QRes.exe" /X 1024 /Y 768 /c 32
Full download can be grabbed here, which includes the qres.exe, the script, and the batch to call the script.
In case your interested, I found this registry key and value by changing the setting in the Intel Graphics GUI (comes with Driver Installation), and monitoring the “RegSetValue” operation in Process Monitor using a filter (see below).
/BG
Nice, thanks!