Sign in to follow this  
Followers 0
bentom

Detect Supported Monitor Refresh rate

3 posts in this topic

Hi,

as I could not figured out how to properly use the Nvidia API for detecting monitor information, I wanted to ask if there is a way to solve this with windows functions.

The objective is to get the supported refresh rates of the digital connected monitor. I then want to use this information to switch to the proper refresh rate when watching movies (e.G. from Pal (50 HZ) to NTSC (60 HZ)

Does anyone here have an idea how to find out this information. There's a function described in the Nvidia API (NVGetDisplayInfo) which should do that but unfortunately the documentation is very difficult to understand.

Thank you very much and Regards,

Alex

Share this post


Link to post
Share on other sites



Most functions I understand but the NVDisplayInfo() in this Document I did not get.

This thread is quite old, but in case someone is still looking for how to do it:

(don't complain about coding style)

#Include <WinAPI.au3>

$_MAX_PATH = 260
$MAX_NVDISPLAYNAME = 256
$MAX_NVMONIKER = 16

$infoStruct = "align 1;dword cbSize; dword dwInputfields1; dword dwOutputfields1; dword dwInputfields2; dword dwOutputfields2; char szWindowsDeviceName[" & $_MAX_PATH & "]; char szAdapterName[" & $MAX_NVDISPLAYNAME & "]; char szDriverVersion[64]; uint nDisplayMode; dword dwWindowsMonitorNumber; uint nDisplayHeadIndex; uint bDisplayIsPrimary; char szDisplayName[" & $MAX_NVDISPLAYNAME & "]; char szVendorName[" & $MAX_NVDISPLAYNAME & "]; char szModelName[" & $MAX_NVDISPLAYNAME & "]; char szGenericName[" & $MAX_NVDISPLAYNAME & "]; dword dwUniqueId; uint nDisplayType; dword mmDisplayWidth; dword mmDisplayHeight; float fGammaCharacteristic; dword dwOptimalPelsWidth; dword dwOptimalPelsHeight; dword dwOptimalDisplayFrequency; dword dwMaximumSafePelsWidth; dword dwMaximumSafePelsHeight; dword dwMaximumSafeDisplayFrequency; dword dwBitsPerPel; dword dwPelsWidth; dword dwPelsHeight; dword dwDisplayFrequency; int rcDisplayRect[4]; dword dwVisiblePelsWidth; dword dwVisiblePelsHeight; dword dwDegreesRotation; int nTvFormat; int nDfpScaling; dword dwTVConnectorTypes; dword dwCurrentConnectorType; dword dwDisplayInstance; dword dwDisplayInstanceCount; char szProductName[" & $MAX_NVDISPLAYNAME & "]; int bDVIOverHDTV; char szConnectedMoniker[" & $MAX_NVMONIKER & "]; char szActiveMoniker[" & $MAX_NVMONIKER & "]; int bSLIEnabled; int bSLIConnector; int bSLICapable; char szCustomName[" & $MAX_NVDISPLAYNAME & "]"

$struct = DllStructCreate($infoStruct)
ConsoleWrite("@: " & @error & @CRLF)
DllStructSetData($struct, "cbSize", DllStructGetSize($struct))
DllStructSetData($struct, "dwInputfields1", 0xffffffff)
DllStructSetData($struct, "dwInputfields2", 0xffffffff)

$dll = DllOpen("nvcpl.dll")
$ret = DllCall($dll, "int", "NvGetDisplayInfo", "str", "0", "ptr", DllStructGetPtr($struct))
ConsoleWrite("Ret: " & int($ret[0]) & @CRLF)
$ret = DllCall($dll, "str", "NvGetLastErrorMessageA")
ConsoleWrite("Ret: " & $ret[0] & @CRLF)
DllClose($dll)

$values = "cbSize,dwOutputfields1,dwOutputfields2,szWindowsDeviceName,szAdapterName,szDriverVersion,nDisplayMode,dwWindowsMonitorNumber,nDisplayHeadIndex,bDisplayIsPrimary,szDisplayName,szVendorName,szModelName,szGenericName,dwUniqueId,nDisplayType,mmDisplayWidth,mmDisplayHeight,fGammaCharacteristic,dwOptimalPelsWidth,dwOptimalPelsHeight,dwOptimalDisplayFrequency,dwMaximumSafePelsWidth,dwMaximumSafePelsHeight,dwMaximumSafeDisplayFrequency,dwBitsPerPel,dwPelsWidth,dwPelsHeight,dwDisplayFrequency,rcDisplayRect,dwVisiblePelsWidth,dwVisiblePelsHeight,dwDegreesRotation,nTvFormat,nDfpScaling,dwTVConnectorTypes,dwCurrentConnectorType,dwDisplayInstance,dwDisplayInstanceCount,szProductName,bDVIOverHDTV,szConnectedMoniker,szActiveMoniker,bSLIEnabled,bSLIConnector,bSLICapable,szCustomName"
ConsoleWrite(@CRLF)
for $data in StringSplit($values, ",")
  ConsoleWrite($data & ": " & DllStructGetData($struct, $data) & @CRLF)
next

; free memory:
$infoStruct = 0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0