Developing Games on Intel Graphics
Ask us questions and get answers, tips, tweaks & techniques from product and technology experts.
The Intel sign-in experience is changing in February to support enhanced security controls. If you sign in, click here for more information.
458 Discussions

What's the equivalent of "Maintain aspect ratio"?

How can I programmatically accomplish the effect of launching Intel GMA Driver control panel applet and selecting "Maintain aspect ratio" on Windows 7? Is there an API call to make, registry entry to change, configuration file to modify?
0 Kudos
4 Replies
I've tried a number of things, without success. The most promising was calling ChangeDisplaySettingsEx() with dmDisplayFixedOutput = DMDFO_CENTER, but that just returns error (-2 bad mode).
We have legacy kiosk software designed for 1024x768 and we're now moving to Windows 7 and to a 16x9 monitor. We don't want the desktop stretched - we want the aspect ratio maintained, understanding that we will have "black bars" on either side of the screen; that's to be addressed in a later release. It's fine if the image is scaled until it fills the screen vertically as long as it is scaled by the same amount horizontally, in fact that's preferable to just showing a 1024x768 image centered in the monitor with black bars on all 4 sides. That Intel GMA Driver checkbox for "Maintain aspect ratio" does exactly what we want (in conjunction with telling Windows the screen is 1024x768). The issue is how can our installer achieve this? We don't have the user interacting with Windows at any point - we can't have him start Control Panel and do this. Anyone have any thoughts?
Valued Contributor II
>>...The most promising was calling ChangeDisplaySettingsEx() with dmDisplayFixedOutput >>=DMDFO_CENTER, but that just returns error (-2 bad mode).

An error code -2 means 'The graphics mode is not supported'. Take a look at MSDN for more

If you can do it with the Control Panel it could be done from an Installer, or any application.

Here are a couple of questions:

Did you try to call to 'EnumDisplaySettings' Win32 API function?

Did you try to update a driver for a '16x9' monitor?

Best regards,
thanks for sharing this information. i think it is useful informtion.

Milo Academy
Milo Adventist Academy
Milo Academy Horses

2 problems with that:

1 - if the image is "wide" and the browser is "tall" then there's a bunch of white space beneath the image.

2 - if the image is taller than the browser window it cuts off the bottom of the image, instead of keeping it vertically centered on the page.

Thanks for the input, but I already talked about that method and it's problems in my original post.

Top MBA Colleges in India
Business School Ranking