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);
SendMessage(lstResolution, LB_ADDSTRING, 0, (LPARAM)txt);
loop++;
}
i++;
}
return 0;
}
Enumerate possible video card resolution
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 :
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.
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
Steve ''Sly'' Williams Monkey Wrangler Krome Studios
turbo game development with Borland compilers
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement