External License file: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
No edit summary |
(+ change editbox limits to afford larger license) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
'''Requires:''' [[System plug-in]]. | '''Requires:''' [[System plug-in]]. | ||
MUI License page "show" function replaces current license text (Dummy.txt added during compilation) with (runtime) License.txt file content. | MUI License page "show" function replaces current license text (Dummy.txt added during compilation) with (runtime) License.txt file content. RTF can be used as well. | ||
== The Script == | == The Script == | ||
Line 25: | Line 25: | ||
; Interface | ; Interface | ||
!include " | !include "MUI2.nsh" | ||
!insertmacro MUI_PAGE_WELCOME | !insertmacro MUI_PAGE_WELCOME | ||
!define MUI_PAGE_CUSTOMFUNCTION_SHOW addLicense | !define MUI_PAGE_CUSTOMFUNCTION_SHOW addLicense | ||
Line 42: | Line 42: | ||
;-------------------------------- | ;-------------------------------- | ||
; Installer Functions | ; Installer Functions | ||
Function addLicense | Function addLicense | ||
ClearErrors | ClearErrors | ||
FileOpen $0 $EXEDIR\${LIC_NAME} r | |||
IfErrors exit | IfErrors exit | ||
System::Call 'kernel32:: | System::Call 'kernel32::GetFileSize(i r0, i 0) i .r1' | ||
IntOp $1 $1 + 1 ; for terminating zero | IntOp $1 $1 + 1 ; for terminating zero | ||
System::Alloc $1 | System::Alloc $1 | ||
Pop $2 | Pop $2 | ||
System::Call 'kernel32::ReadFile(i r0, i r2, i r1, *i .r3, i 0)' | System::Call 'kernel32::ReadFile(i r0, i r2, i r1, *i .r3, i 0)' | ||
FileClose $0 | |||
FindWindow $0 "#32770" "" $HWNDPARENT | FindWindow $0 "#32770" "" $HWNDPARENT | ||
GetDlgItem $0 $0 1000 | GetDlgItem $0 $0 1000 | ||
SendMessage $0 ${WM_SETTEXT} | SendMessage $0 ${EM_SETLIMITTEXT} $1 0 | ||
SendMessage $0 ${WM_SETTEXT} 0 $2 | |||
System::Free $2 | System::Free $2 | ||
exit: | exit: |
Latest revision as of 09:18, 16 September 2008
Author: Takhir (talk, contrib) |
Description
Requires: System plug-in.
MUI License page "show" function replaces current license text (Dummy.txt added during compilation) with (runtime) License.txt file content. RTF can be used as well.
The Script
;-------------------------------- ; Base names definition !define LIC_NAME "License.txt" !define APP_NAME "License Test" ;-------------------------------- ; General Attributes Name "${APP_NAME}" OutFile "${APP_NAME}.exe" ;-------------------------------- ; Interface !include "MUI2.nsh" !insertmacro MUI_PAGE_WELCOME !define MUI_PAGE_CUSTOMFUNCTION_SHOW addLicense !insertmacro MUI_PAGE_LICENSE Dummy.txt !insertmacro MUI_LANGUAGE "English" ;-------------------------------- ; Installer Sections Section "Dummy Section" SecDummy SectionEnd ;-------------------------------- ; Installer Functions Function addLicense ClearErrors FileOpen $0 $EXEDIR\${LIC_NAME} r IfErrors exit System::Call 'kernel32::GetFileSize(i r0, i 0) i .r1' IntOp $1 $1 + 1 ; for terminating zero System::Alloc $1 Pop $2 System::Call 'kernel32::ReadFile(i r0, i r2, i r1, *i .r3, i 0)' FileClose $0 FindWindow $0 "#32770" "" $HWNDPARENT GetDlgItem $0 $0 1000 SendMessage $0 ${EM_SETLIMITTEXT} $1 0 SendMessage $0 ${WM_SETTEXT} 0 $2 System::Free $2 exit: FunctionEnd