Function GetVRefresh: Integer;
Const
ENUM_CURRENT_SETTINGS : Cardinal = Cardinal(-1);
//$ffffffff; // = -1
Var
lpDevMode: TDeviceMode;
lRegInfo : TRegistry;
lRefresh : Integer;
lDesktop : HDC;
Begin
lRefresh := 0;
FillChar(lpDevMode, SizeOf(lpDevMode), 0);
lpDevMode.dwSize := SizeOf(lpDevMode);
If ( EnumDisplaySettings(
Nil, ENUM_CURRENT_SETTINGS, lpDevMode) )
Then
Begin
If ( ( lpDevMode.dmFields
And DM_DISPLAYFREQUENCY ) > 0 )
Then
lRefresh := lpDevMode.dmDisplayFrequency
Else If ( Win32Platform = VER_PLATFORM_WIN32_WINDOWS )
Then // Win9x/ME
Begin
lRegInfo := TRegistry.Create(KEY_READ);
lRegInfo.RootKey := HKEY_CURRENT_CONFIG;
Try
If lRegInfo.OpenKey('
\Display\Settings', False)
Then
Begin
lRefresh := StrToIntDef(lRegInfo.ReadString('
RefreshRate'), 0);
End;
Finally
lRegInfo.CloseKey;
lRegInfo.Free;
End;
End;
End;
If ( lRefresh
In [0,1] )
Then // hardware default versuchen zu umgehen
Begin
lDesktop := GetDC(0);
Try
lRefresh := GetDeviceCaps(lDesktop, VREFRESH);
Finally
ReleaseDC(0, lDesktop);
End;
End;
Result := lRefresh;
End;