getting the monitor refresh rate
i need a win api function that gives me the current set refresh rate of the monitor in windows.
i have been looking thru the docs for quite a while but couldn''t find anything that serves this purpose.
in fullscreen i can use dx to retrieve the refresh rate, but not in windowed mode. there is bound to be a function for this, but i just can''t find it
thanks
ridcully
DEVMODE devmode;
memset(&devmode, 0, sizeof(DEVMODE));
devmode.dmSize = sizeof(DEVMODE);
devmode.dmFields = DM_DISPLAYFREQUENCY;
//---------------- ---- --- -- -
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode);
The good news is that this''ll give you the refresh rate in the current display mode. The bad news is that this function seems to return either 0 or 1 on Windows 95/98--I haven''t really done enough testing on my own, so try it yourself before giving up--both of which indicate the "default" refresh rate, whatever the hell Microsoft means by that. Look up EnumDisplaySettings in MSDN for more info.
memset(&devmode, 0, sizeof(DEVMODE));
devmode.dmSize = sizeof(DEVMODE);
devmode.dmFields = DM_DISPLAYFREQUENCY;
//---------------- ---- --- -- -
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode);
The good news is that this''ll give you the refresh rate in the current display mode. The bad news is that this function seems to return either 0 or 1 on Windows 95/98--I haven''t really done enough testing on my own, so try it yourself before giving up--both of which indicate the "default" refresh rate, whatever the hell Microsoft means by that. Look up EnumDisplaySettings in MSDN for more info.
thanks for the hint
but as you said, it always returns 0 or 1, and the platform sdk documentation said why:
"When you call the EnumDisplaySettings function, the dmDisplayFrequency member may return with the value 0 or 1. These values represent the display hardware''s default refresh rate. This default rate is typically set by switches on a display card or computer motherboard, or by a configuration program that does not use Win32 display functions such as ChangeDisplaySettings."
sad, isn''t it
anyone knowing a method that works?
thanks
ridcully
but as you said, it always returns 0 or 1, and the platform sdk documentation said why:
"When you call the EnumDisplaySettings function, the dmDisplayFrequency member may return with the value 0 or 1. These values represent the display hardware''s default refresh rate. This default rate is typically set by switches on a display card or computer motherboard, or by a configuration program that does not use Win32 display functions such as ChangeDisplaySettings."
sad, isn''t it
anyone knowing a method that works?
thanks
ridcully
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement