You are here

NSIS Code Help

4 posts / 0 new
Last post
enzeinzen
Offline
Last seen: 2 months 3 weeks ago
Joined: 2017-05-19 10:39
NSIS Code Help

Hi people, I need some help with a piece of NSIS code from someone who knows what he's doing.

I have managed to implement automatic resolution detection in my portable app using the code from this thread:
https://portableapps.com/node/31743 namely:

${SegmentFile}
${SegmentInit}
System::Call user32::GetSystemMetrics(i0)i.r0
System::Call user32::GetSystemMetrics(i1)i.r1
${SetEnvironmentVariable} ScreenHeight $0
${SetEnvironmentVariable} ScreenWidth $1
!macroend

Now for the question, how do i do the same thing for the refresh rate and set it to something like %FrameRate%?
Also, when that's done, how do i use the NSIS code to divide 1 by %FrameRate%?

Any help would be very much appreciated.
Thanks a lot for your time.

John T. Haller
John T. Haller's picture
Online
Last seen: 10 min 8 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
EnumDisplaySettings

Possibly EnumDisplaySettings, but I don't know if that will show you the current, just the possible ones. Getting the refresh rate doesn't seem to be a common activity.

Sometimes, the impossible can become possible, if you're awesome!

enzeinzen
Offline
Last seen: 2 months 3 weeks ago
Joined: 2017-05-19 10:39
EnumDisplaySettings(NULL,

EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &lpDevMode)

This is the function i need apparently. How do you put this in NSIS and make %FrameRate% take this value?

EDIT:So I came up with this but it's very wrong.

{SegmentFile}
${SegmentInit}
System::Call user32::EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &lpDevMode)i.r0
${SetEnvironmentVariable} FrameRate $0
!macroend

John T. Haller
John T. Haller's picture
Online
Last seen: 10 min 8 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
EnumDisplayDevices

I think you'll need to do EnumDisplayDevices first to get the right display. Then pass it into EnumDisplaySettings. I don't have time to delve into it deeper, unfortunately. NSIS isn't really the best language for these sorts of things, so it gets convoluted. There are also some DirectX APIs that may work a bit better.

Sometimes, the impossible can become possible, if you're awesome!

Log in or register to post comments