Distinguish between panning and normal screen modes in code - Windows
Asked Answered
M

1

10

I am writing a full-screen 3D game and I have created a menu in which the user may select the screen resolution to match his hardware capacity.

I am enumerating all the available screen modes with EnumDisplaySettingsExA like this:

std::vector<DEVMODEA> modes;
DEVMODEA modeInfo;
int modeNum = -1;
while (EnumDisplaySettingsExA(0, ++modeNum, &modeInfo, 0)) {
    if (modeInfo.dmBitsPerPel < 16) continue;
    modes.push_back( modeInfo );
}

The problem is, I am getting panning-modes as well! I can't distinguish which are which; for example my ATI laptop has a maximum normal mode of 1280x800, but also contains a panning-mode of 1024x600!

Anyone knows of a way to distinguish between the 2, so I can reject panning-modes from my menu?

Minim answered 23/7, 2010 at 8:52 Comment(10)
BTW, the dmPanningWidth and Height fields of DEVMODEA are useless, they always return 0.Minim
What do you mean by panning-mode? When EnumDisplaySettingsEx returns 1024x600, that means the windows user can change the video display settings to that resolution, and the monitor will probably support that as well.Supernaturalism
@Chris: It refers to a resolution which isn't supported by the monitor, usually because it is too large, but is emulated by the graphics card by displaying only part of the desktop on the screen at a time; moving the mouse to the edge of the screen will "pan" it to show other parts of the desktop.Casease
Unfortunately, I don't know a way to query if the graphics-card supports this, or querying which resolutions are panned (it depends on both the graphics card and the monitor...) - I have a feeling you're looking a vendor-specific code. Does anyone other than ATI support this?Casease
Then this panning is a feature of your ATI and its driver. Typically when EnumDisplaySettingsEx returns the lower resolution and the user selects this from the display settings UI, it means that the display resolution does in fact go to the lower resolution (no panning) and maybe the monitor displays it OK, maybe not. The panning in this case, sounds like a proprietary feature of your ATI driver, might be possible to disable that so the resolutions returned by EnumDisplaySettingsEx behave as expected (no panning).Supernaturalism
It might be possible that DirectX can return this info, but I really don't know, I've haven't tried using DirectX to get video/monitor resolutions, only the win API.Supernaturalism
"...normal mode of 1280x800, but also contains a panning-mode of 1024x600..." -- wouldn't the resolution of the panning mode be higher than the normal maximum resolution?Holdback
Any reason why not using DirectX?Maomaoism
@BlueRaja - Danny Pflughoeft Thanks for the explanation.Supernaturalism
@Martin the 1024x600 panning mode is probably a 800x600 hardware mode with the extra horizontal pixels (224).Fishman
H
1

@Martin: I'm guessing the OP just put the res's in the wrong order.

Is this link about what you're looking for?

It looks like it's the proper way to get the pixel dimensions of a screen in Windows.

Hiramhirasuna answered 10/2, 2011 at 1:20 Comment(1)
@Bill Kotsias - This function uses underlying Windows monitors functions such as EnumDisplayMonitors, GetMonitorInfo or MonitorForWindow, but I'm not sure it will help you.Testicle

© 2022 - 2024 — McMap. All rights reserved.