News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Enumerating RefreshRates

Started by Siekmanski, December 02, 2018, 11:16:02 PM

Previous topic - Next topic

Siekmanski

Hi,

I'm working on a 2D sprite routine in full-screen mode
I need the actual monitor RefreshRate to do some calculations.

According to MSDN when enumerating RefreshRates it can return 0 Hz.
The value of 0 Hz indicates an adapter default.
But with 0 Hz I can't use that value for my calculations because it could be 60 or 85 Hz etc.

Now I'm curious if it returns 0 Hz, if it is only the first of all enumerated values?

I have enumerated all refreshrates for a 1024 X 768 full-screen resolution.
So, my question is: If someone of you gets a returned refreshrate of 0Hz, could you then post all "Hz" values?

Thanks.
Creative coders use backward thinking techniques as a strategy.

jj2007

13 modes, 60Hz for both 1024 and 1366px wide. Acer Notebook on Win7-64, lowcost NVidia card.

Biterider


aw27

I have never seen a refresh rate of 0 or 1 in my whole life but Microsoft says they exist.

Siekmanski

I have also never seen a 0 Hz refreshrate.
Thinking it all over, it could be that if you set 0 Hz as an input value, the adapter automatically sets it to the default refreshrate.
I have just tested this with an input value of 0 and the monitors refreshrate is set to 60 Hz. ( my default refreshrate )

If I'm correct, when enumerating the refreshrate output values, it will never send back 0 Hz refreshrates because 0 can only be an input value?
I hope this is the case, MSDN is not very clear on that subject.
Creative coders use backward thinking techniques as a strategy.

FORTRANS

Hi,

Windows 2000, no response.  No required DLL?

Windows XP

AdapterModeCount: 13
Monitor Aspect Ratio: 1.333
1024x768 60 Hz
Actual 1024x768 60 Hz

Windows 8.1

AdapterModeCount: 10
Monitor Aspect Ratio: 1.779
1024x768 40 Hz
1024x768 60 Hz
Actual 1366x768 60 Hz


HTH,

Steve N.

felipe

Hi siekmanski, the program fails to run on my system. It seems that fails in the function call to CreateDirect3d9 something... :idea:

felipe

Siekmanski i think i was wrong the problem is not there. Maybe it's at some point when making a call to a d3d9 function when an error with "a not module found" message error and then seems like occurs an infinite loop. But i can't confirm this because i would have to play for a long time with the debugger...What do you think it is?  :idea:

Siekmanski

Hi Felipe,

Try this version, it will return an error number so I have an indication were to look in the code.
Be sure to unzip the files, it could be that the bitmap images are not correctly loaded when executed from within the zip file.
Creative coders use backward thinking techniques as a strategy.

HSE

Hi Siekmanski!

I don't pay to much atention yesterday!  Work perfectly if you open and close, but if program lost focus then there is a problem if you try to activate it.
Equations in Assembly: SmplMath

Siekmanski

Hi HSE,

Yeah I know, I didn't include "restore lost devices" when focus is lost.  :biggrin:
Maybe I'll implement code that prevents using ALT-TAB, I'm not sure yet....
Creative coders use backward thinking techniques as a strategy.

HSE

No problem then, just a "feature", :biggrin:
Equations in Assembly: SmplMath

aw27

This is an alternative way of enumeration (I believe Siekmanski is doing it from Dx9):


#include <stdio.h>
#include <conio.h>
#include <windows.h>

int main()
{
DWORD iMode = 0;
BOOL bRetVal;

printf("Available Video Modes\n\n");
do
{
DEVMODE dm = { 0 };
bRetVal = EnumDisplaySettings(NULL, iMode, &dm);
iMode++;
if (bRetVal)
{

printf("%d x %d, %d bits %dhtz\n", dm.dmPelsWidth,
dm.dmPelsHeight, dm.dmBitsPerPel, dm.dmDisplayFrequency);
}
}
while (bRetVal);

_getch();
}


Available Video Modes

640 x 480, 32 bits 59htz
640 x 480, 32 bits 60htz
640 x 480, 32 bits 75htz
720 x 480, 32 bits 60htz
720 x 480, 32 bits 59htz
720 x 576, 32 bits 50htz
800 x 600, 32 bits 60htz
800 x 600, 32 bits 75htz
1024 x 768, 32 bits 60htz
1152 x 864, 32 bits 60htz
1152 x 864, 32 bits 60htz
1152 x 864, 32 bits 60htz
1176 x 664, 32 bits 50htz
1176 x 664, 32 bits 50htz
1176 x 664, 32 bits 50htz
1176 x 664, 32 bits 60htz
1176 x 664, 32 bits 60htz
1176 x 664, 32 bits 60htz
1176 x 664, 32 bits 59htz
1176 x 664, 32 bits 59htz
1176 x 664, 32 bits 59htz
1280 x 720, 32 bits 60htz
1280 x 720, 32 bits 59htz
1280 x 720, 32 bits 50htz
1280 x 768, 32 bits 60htz
1280 x 768, 32 bits 60htz
1280 x 768, 32 bits 60htz
1280 x 800, 32 bits 60htz
1280 x 960, 32 bits 60htz
1280 x 960, 32 bits 60htz
1280 x 960, 32 bits 60htz
1280 x 1024, 32 bits 60htz
1360 x 768, 32 bits 60htz
1360 x 768, 32 bits 60htz
1360 x 768, 32 bits 60htz
1366 x 768, 32 bits 60htz
1366 x 768, 32 bits 60htz
1366 x 768, 32 bits 60htz
1600 x 900, 32 bits 60htz
1600 x 1024, 32 bits 59htz
1600 x 1024, 32 bits 60htz
1600 x 1024, 32 bits 59htz
1600 x 1024, 32 bits 60htz
1600 x 1024, 32 bits 59htz
1600 x 1024, 32 bits 60htz
1680 x 1050, 32 bits 59htz
1680 x 1050, 32 bits 60htz
1768 x 992, 32 bits 25htz
1768 x 992, 32 bits 25htz
1768 x 992, 32 bits 25htz
1768 x 992, 32 bits 30htz
1768 x 992, 32 bits 30htz
1768 x 992, 32 bits 30htz
1768 x 992, 32 bits 29htz
1768 x 992, 32 bits 29htz
1768 x 992, 32 bits 29htz
1920 x 1080, 32 bits 60htz
1920 x 1080, 32 bits 59htz
1920 x 1080, 32 bits 50htz
1920 x 1080, 32 bits 30htz
1920 x 1080, 32 bits 29htz
1920 x 1080, 32 bits 25htz

Interesting that the AdaptarModeCount I got from Siemanski's was 36 and here I have more modes.

Siekmanski

Yes I used DX9 for the enumeration and only for 32 bits resolutions without the alpha channel.
Creative coders use backward thinking techniques as a strategy.

felipe

I have unzipped correctly both files. This time i see a black color full screen for 1  or 2 seconds and then the program is stopped by windows.  :( I this some indicator of a problem with my graphic video adapter??  :idea: