You are here

Custom Code to get Refresh Rate?

5 posts / 0 new
Last post
enzeinzen
Offline
Last seen: 2 months 3 weeks ago
Joined: 2017-05-19 10:39
Custom Code to get Refresh Rate?

Hi, I'm using the following code to get the display height and width:

${SegmentFile}

${SegmentInit}
System::Call user32::GetSystemMetrics(i0)i.r0
System::Call user32::GetSystemMetrics(i1)i.r1

${SetEnvironmentVariable} ScreenWidth $0
${SetEnvironmentVariable} ScreenHeight $1
!macroend

However, I really need the screen refresh rate as well. I have no idea how to incorporate win32 functions into NSIS. Can you help me?
Thanks.

Gord Caswell
Gord Caswell's picture
Offline
Last seen: 1 hour 56 min ago
DeveloperModerator
Joined: 2008-07-24 18:46
you've previously asked

You've previously asked for this here: https://portableapps.com/node/56216

enzeinzen
Offline
Last seen: 2 months 3 weeks ago
Joined: 2017-05-19 10:39
Oh yeah, sorry about that, I

Oh yeah, sorry about that, I completely forgot. Still, I didn't really get any solution 2 years ago.

mjashby
Offline
Last seen: 1 month 1 week ago
Developer
Joined: 2008-09-19 13:35
NSIS Programming

Wouldn't it be better asking the question on a 'specialist' NSIS Forum, where there is a larger target audience?

enzeinzen
Offline
Last seen: 2 months 3 weeks ago
Joined: 2017-05-19 10:39
The guys over on the NSIS

The guys over on the NSIS forum supplied me with this bit of code:

!define /IfNDef CCHDEVICENAME 32
!define /IfNDef CCHFORMNAME 32
!define /IfNDef ENUM_CURRENT_SETTINGS -1
!define /IfNDef DM_DISPLAYFREQUENCY 0x00400000L
!include LogicLib.nsh
System::Call '*(&i${CCHDEVICENAME},i,&l2,&i2,i0, i,i,i,i, i,i,&i2,&i${CCHFORMNAME},&i2,i,i,i,i,i)p.r1'
System::Call 'USER32::EnumDisplaySettingsA(p0, i${ENUM_CURRENT_SETTINGS}, pr1)i.r0'
System::Call '*$1(&i${CCHDEVICENAME},i,&l2,&i2,i, i,i,i,i, i,i,&i2,&i${CCHFORMNAME},&i2,i,i,i,i,i.r2)'
System::Free $1
${If} $0 0
DetailPrint $2
${EndIf}

Does anyone know how to make this useable in PAL?
Thanks a lot.

Log in or register to post comments