Archived

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

Dunge

Enumerate possible video card resolution

Recommended Posts

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);
			SendMessage(lstResolution, LB_ADDSTRING, 0, (LPARAM)txt);
			loop++;
		}
		i++;
	}
	return 0;
}
  

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites