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.
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!
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
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!