메뉴 건너뛰기

오에스매니아

http://nsis.sourceforge.net/Main_Page


NSIS는 멀티라이센스 예제올려봅니다.


!include "MUI2.nsh"
!include "Sections.nsh"


Name "Multiple Licences" ;제목
OutFile "TwoLicenses-MUI2.exe"  ;실행파일이름
InstallDir "$PROGRAMFILES\TwoLicenses" ;설치폴더지정
RequestExecutionLevel user ;권한

!insertmacro MUI_PAGE_WELCOME ;시작화면
!insertmacro MUI_PAGE_LICENSE           "License_One.txt" ;다중라이센스 1번파일
!insertmacro MUI_PAGE_LICENSE           "License_Two.txt" ;다중라이센스 2번파일

;!define MUI_PAGE_CUSTOMFUNCTION_PRE ComponentsPage1Pre
!define MUI_PAGE_CUSTOMFUNCTION_PRE COMPONENTS_Pre
!define MUI_PAGE_CUSTOMFUNCTION_SHOW COMPONENTS_Pre
!insertmacro MUI_PAGE_COMPONENTS 
!define MUI_PAGE_CUSTOMFUNCTION_PRE DIRECTORY_Pre
!define MUI_PAGE_CUSTOMFUNCTION_SHOW DIRECTORY_Pre
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_FINISH


Function COMPONENTS_Pre
  FindWindow $0 "#32770" "" $HWNDPARENT
  GetDlgItem $0 $0 1006
  SendMessage $0 ${WM_SETTEXT} 0 'STR:설치하려는 구성요소 선택:'
  FindWindow $0 "#32770" "" $HWNDPARENT
  GetDlgItem $0 $0 1021
  SendMessage $0 ${WM_SETTEXT} 0 'STR:이용약관'
  FindWindow $0 "#32770" "" $HWNDPARENT
  GetDlgItem $0 $0 1022
  SendMessage $0 ${WM_SETTEXT} 0 'STR:프로그램을 원치 않으시면 해제하세요.'

  GetDlgItem $R0 $HWNDPARENT 1037
  SendMessage $R0 ${WM_SETTEXT} 0 "STR:구성 요소 선택"
  CreateFont $R1 "$(^Font)" "11" "600"

  GetDlgItem $R0 $HWNDPARENT 1038
  SendMessage $R0 ${WM_SETTEXT} 0 "STR:설치하고자 하는 구성 요소를 선택해 주세요.."
  CreateFont $R1 "$(^Font)" "$(^FontSize)" "500"
FunctionEnd


!insertmacro MUI_LANGUAGE "Korean" ; ID = 1042
!insertmacro MUI_LANGUAGE "English" ; ID = 1033
LicenseLangString license ${LANG_ENGLISH} "License_One.txt"
LicenseLangString license ${LANG_Korean} "License_Two.txt"


Section "Dummy1" SEC1
  ; do nothing
SectionEnd

Section "Dummy2" SEC2
  ; do nothing
SectionEnd


Function DIRECTORY_Pre
  FindWindow $0 "#32770" "" $HWNDPARENT
  GetDlgItem $0 $0 1006
  SendMessage $0 ${WM_SETTEXT} 0 'STR:프로그램을 다음 폴더에 설치할 예정입니다. 계속 하시려면 "다음"을 눌러주십시오.'
  FindWindow $0 "#32770" "" $HWNDPARENT
  GetDlgItem $0 $0 1033
  SendMessage $0 ${WM_SETTEXT} 0 'STR:라이센스'
 

${If} ${SectionIsSelected} ${SEC1}  ;1번라인 아래 (멀티라이센스)
  FindWindow $0 "#32770" "" $HWNDPARENT
  GetDlgItem $0 $0 1034
  SendMessage $0 ${WM_SETTEXT} 0 'STR:Dummy1'
  FindWindow $0 "#32770" "" $HWNDPARENT
  GetDlgItem $0 $0 1030
  SendMessage $0 ${WM_SETTEXT} 0 'STR:$PROGRAMFILES\Dummy1'
Goto LINE1_SEC1_SET
${Else}
Goto LINE1_SEC1_END
${EndIf}


LINE1_SEC1_END:  ; 2번라인 아래  (멀티라이센스)
${If} ${SectionIsSelected} ${SEC2}
  FindWindow $0 "#32770" "" $HWNDPARENT
  GetDlgItem $0 $0 1034
  SendMessage $0 ${WM_SETTEXT} 0 'STR:Dummy2'
  FindWindow $0 "#32770" "" $HWNDPARENT
  GetDlgItem $0 $0 1030
  SendMessage $0 ${WM_SETTEXT} 0 'STR:$PROGRAMFILES\Dummy2'
Goto LINE2_SEC2_SET
${Else}
${EndIf}


LINE1_SEC1_SET:
${If} ${SectionIsSelected} ${SEC2}
  FindWindow $0 "#32770" "" $HWNDPARENT
  GetDlgItem $0 $0 1035
  SendMessage $0 ${WM_SETTEXT} 0 'STR:Dummy2'
  FindWindow $0 "#32770" "" $HWNDPARENT
  GetDlgItem $0 $0 1031
  SendMessage $0 ${WM_SETTEXT} 0 'STR:$PROGRAMFILES\Dummy2'
${Else}

${EndIf}
LINE2_SEC2_SET:
FunctionEnd


!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  !insertmacro MUI_DESCRIPTION_TEXT ${SEC1} "멀티txt-1 테스트합니다."
   ClearErrors
   InitPluginsDir
   File /oname=$PLUGINSDIR\License_Two.txt "License_Two.txt"
   FileOpen $0 "$PLUGINSDIR\License_Two.txt" 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:


  !insertmacro MUI_DESCRIPTION_TEXT ${SEC2} "멀티txt-2 테스트합니다."
   ClearErrors
   InitPluginsDir
   File /oname=$PLUGINSDIR\License_One.txt "License_One.txt"
   FileOpen $0 "$PLUGINSDIR\License_One.txt" r
   IfErrors exit2
   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
   exit2:

!insertmacro MUI_FUNCTION_DESCRIPTION_END

위로

Master of OS Mania
×

진정한 OS를 알아볼수 있는 전문가 집단.

오에스매니아 에 가입하십시요

그동안 보지 못한 신세계를 만날수 있습니다.