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


Screen Res

Recommended Posts

Hi everybody- Does anyone know if there is a function or a procedure to get the current window resolution? For example, I have Windows98 at a resolution of 1600x1200 and I have a program that runs in a window mode at 800x600. I want to know how my program can know what the Windows98 resolution is. Thank everybody for your help.

Share this post

Link to post
Share on other sites
Yes, there is a way, this is the way i do it

// The Part following goes in the header
//screen mode type
typedef struct
int width ;
int height ;
int bpp ;

//to get the current screen mode
SCREEN_MODE SCREEN_get_current_resolution();

// The Part Following will go in the *.cpp file
SCREEN_MODE SCREEN_get_current_resolution()
DEVMODE devmode ;

result.width = 0 ;
result.height = 0 ;
result.bpp = 0 ;
ZeroMemory( &devmode, sizeof(DEVMODE));
devmode.dmSize = sizeof(DEVMODE);
if( EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS , &devmode ) == TRUE )
result.width = devmode.dmPelsWidth ;
result.height = devmode.dmPelsHeight ;
result.bpp = devmode.dmBitsPerPel ;

return result ;

Hope this helps, The function return, Width height and Bits per Pixel/Colours.

Share this post

Link to post
Share on other sites
Isn''t there a much simpler way to do this....some functoin like GetSystemMetrics or something....look it up on the msdn. Sorry I can''t provide any more info but I just can''t remember!


Share this post

Link to post
Share on other sites