#### Archived

This topic is now archived and is closed to further replies.

# Enumerate possible video card resolution

## Recommended Posts

Dunge    405
Damn I hate windows.. I used EnumDisplaySettings to enumerate the possible resolutions the video card can have.. it work fine on win9x but I test on XP and the list triple,.. why? because they added a new "resolution" for each DisplayFrequency in a resolution. I thought, cool I will add the option to choose this too but when I go back to win9x the displayfrequency is always 0... look strange in a list 640x480x0 800x600x0 so damn how should I do it? here is my code :

static DEVMODE dm[99];

int EnumResolution()
{
for (int loop = 0; loop < 100; loop++)
dm[loop].dmSize = sizeof(dm[loop]);
int i = 0;
loop = 0;

while(EnumDisplaySettings(NULL, i, &dm[loop]))
{
if (dm[loop].dmBitsPerPel == 16 || dm[loop].dmBitsPerPel == 32)
{
char txt[16];
sprintf(txt, "%dx%dx%dx%d", dm[loop].dmPelsWidth, dm[loop].dmPelsHeight, dm[loop].dmBitsPerPel, dm[loop].dmDisplayFrequency);
loop++;
}
i++;
}
return 0;
}


##### Share on other sites
IndirectX    122
Displayfrequency 0 refers to the default refresh rate, which is usually lowest, ie 60 hz. In my enumerator, I just record the highest refresh rates available for each mode.

##### Share on other sites
Sly    128
It is not Windows but the video driver that decides whether to enumerate all refresh rates or not. A refresh rate of zero means that it is not going to tell you which refresh rates are available. When creating the string, simply check the value of refresh rate. If it is non-zero, then add it to the string. It is zero, then do not write out the refresh rate.

Steve ''Sly'' Williams  Monkey Wrangler  Krome Studios
turbo game development with Borland compilers