Skip to content
⌘ NSIS Forum Archive

Custom License Page - big license file

2 posts

HandShake#

Custom License Page - big license file

Hello,

I am new in NSIS.

I have to add a "Save License File" button on (a custom) license page.

My problem is that if the license.txt is bigger than 1024 B, the file is displayed trimmed.

        FileOpen $0 "$INSTDIR/License.txt" r 
         StrCpy $file "" ; initialize! 
         loop: 
              FileRead $0 $2 
              IfErrors done 
              StrCpy $file "$file$2" 
              Goto loop 
         done: 
              FileClose $0 
    !insertmacro CHANGETEXTFIELD "${DIALOG1}" "${CMD_FIELD_2}" $file 
  !macro CHANGETEXTFIELD FILE ELEMENT VALUE
  Push $R0 ; holds value
  !insertmacro MUI_INSTALLOPTIONS_WRITE ${VALUE} "${FILE}" "${ELEMENT}" "State"
  !insertmacro MUI_INSTALLOPTIONS_READ $R0 "${FILE}" "${ELEMENT}" "HWND"
  SendMessage $R0 ${WM_SETTEXT} 0 "STR:${VALUE}"
  Pop $R0
  !macroend 
I've tried to add a custom button on the a default License page. But if I add a custom button over the existing controls, the "old" controls disappears.

!define MUI_PAGE_CUSTOMFUNCTION_PRE lic_pre
!insertmacro MUI_PAGE_LICENSE "License.txt" 
Function lic_pre
  !insertmacro MUI_HEADER_TEXT "Title" "Subtitle"  
   nsDialogs::Create 1018 
         ${NSD_CreateCheckbox} 60% 90% 50% 6% "Show button below"
        Pop $hwnd
        ${NSD_OnClick} $hwnd EnDisableButton
    ${NSD_CreateButton} 25% 25% 50% 50% "Hello World"
        Pop $button
        ShowWindow $button ${SW_HIDE} # start out hidden
   nsDialogs::Show 
FunctionEnd 
Can you please give me a hint ...?
I must Add a new button...
10x.
Anders#
Search the forum for EM_STREAMIN or something like that and you should find a thread about reading large license files