How do I retrieve a monitor’s default refresh rate?
If I query for the current mode’s refresh rate I may be returned either
0 or 1, both indicating a default refresh rate. But I found no way to
retrieve what this default is. I know it can be overridden via the
DxDiag interface - still, not even such interface will tell what’s the
Can I safely assume a value of 60 Hz? Apparently not. Some people have
their monitors set to 59 Hertz when they activate some resolutions.
A manual count of the vertical blank intervals over a period of 1
second isn’t always a viable option for me.
Thanks in advance.
Please log in or register to post a reply.
I googled around a bit, but no one seems to know a solid way to get the
current video mode in DXGI…the closest I found was this StackOverflow
which recommends using
then trying to find a matching DXGI mode.
All methods seem to be fallible in a way or another. Searching among
the list of display modes is no safer. The very list may have
frequencies of 0 - this used to be my case with my previous gfx card. I
admit that now I see no zeroes in the caps viewer, still I don’t feel
safe. Then again the default frequency isn’t necessarily the lowest of
the lot. Take my case of 800x600 R5G6B5. I know my Default frequency is
60 Hz. But I see my monitor also supports 800x600 R5G6B5 56 Hz. Imagine
the surprise when I saw that.
So far my idea is that the default frequency is the one common to
*all* available display modes. 60 Hz for me. But if said Default is
altered by the user through DxDiag, then it could be anything else. I
don’t suppose you know the Registry key that holds the user-specified
override for the DirectDraw’s default frequency? Knowing that might
solve the problem (if, and I stress *IF*, the default frequency is
indeed the one common to all display modes).
If at least Windows wasn’t in the way of the I/O ports, one could read
the settings for the PIC’s second counter, and from there derive the
monitor’s frequency in use. Now *that* would be infallible. Naturally
I’m in ring 3… and tools like WinIO are overkill.
Any and every method I find that could be used to retrieve the monitor’s
frequency will warn against a possible return of 0 or 1 to indicate the
misty Default frequency.
The only method that doesn’t say anything about Defaults is
IDirectDraw7::GetMonitorFrequency(). Does it guarantee success??
Right now it sounds like my best bet, so I’ll go that route.