Get User's screen resolution: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Updated author and download links, and changed format of some pages.) |
m (Added primary monitor warning) |
||
(4 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{PageAuthor|Joel}} | |||
<div style="border: 1px solid #404000; background-color:#f8f880; color:#000; padding:0.5em;"><b>Note: </b>This gets the resolution of the primary monitor. The system may have other monitors.</div> | |||
== The Script == | == The Script == | ||
<highlight-nsis> | <highlight-nsis> | ||
Line 20: | Line 24: | ||
</highlight-nsis> | </highlight-nsis> | ||
[[Category:System Plugin Examples]] |
Latest revision as of 20:03, 28 September 2022
Author: Joel (talk, contrib) |
Note: This gets the resolution of the primary monitor. The system may have other monitors.
The Script
; Get User screen resolution OutFile "ScreenRes.exe" Name "Get User Screen Resolution" Caption "Get User Screen Resolution" XPStyle "on" Function ".onInit" System::Call 'user32::GetSystemMetrics(i 0) i .r0' System::Call 'user32::GetSystemMetrics(i 1) i .r1' MessageBox MB_OK|MB_ICONINFORMATION "Screen Resolution: $\r$\n$0 X $1" Quit FunctionEnd Section "-boo" ; SectionEnd