PDA

View Full Version : Use of EnumDisplaySettings under VC++



pech
03-14-2002, 04:37 AM
Does anyone know how to use :
EnumDisplaySettings

I would like to display all the screen resolution available on my 3D card ?

I'm real newbie in windows programming, i know... ;P

Diapolo
03-14-2002, 06:06 AM
I do it currently in the following way (not exactly that function, but a more tweaked one and + support for refresh rates on NT bases OS´es:





void EnumerateDisplayModes(void)
{
DEVMODE dm;
memset(&dm, 0, sizeof(DEVMODE));
dm.dmSize = sizeof(DEVMODE);
dm.dmFields= DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;

DWORD TestWidth[5] = {640, 800, 1024, 1280, 1600};
DWORD TestHeight[5] = {480, 600, 768, 1024, 1200};
DWORD TestDepth[2] = {16, 32};
for(int i = 0, j = 0; i <= 4 &amp;&amp; j <= 1; j++)
{
dm.dmPelsWidth = TestWidth[i];
dm.dmPelsHeight = TestHeight[i];
dm.dmBitsPerPel = TestDepth[j];

if(ChangeDisplaySettings(&amp;dm, CDS_TEST) == DISP_CHANGE_SUCCESSFUL)
{
// Mode OK process ist somehow
}

if(j == 1)
{
j = -1;
i++;
}
}
}


One advice, if you are on a NT based OS you have to take care of DM_DISPLAYFREQUENCY if you do it good http://www.opengl.org/discussion_boards/ubb/smile.gif.

Diapolo

pech
03-14-2002, 01:11 PM
Originally posted by Diapolo:

One advice, if you are on a NT based OS you have to take care of DM_DISPLAYFREQUENCY if you do it good http://www.opengl.org/discussion_boards/ubb/smile.gif.

Diapolo

It works great,thanks a lot ! http://www.opengl.org/discussion_boards/ubb/wink.gif
I'll try to focus my attention on the display frequency ;P thanks

Diapolo
03-14-2002, 02:16 PM
No problem http://www.opengl.org/discussion_boards/ubb/smile.gif.

Help and get helped!

Diapolo