jdt2oo7
11th December 2009, 06:03
Hi all,
Please see code below.
I am using the addLicense from the forum to display EULA file according to user's selection.
The problem I am having is that: it always display the default file (en-US).
I know for a fact that it went to the right country comparison in the If/ElseIf statements by using MessageBox to verify.
Seem like it couldn't find the file in the statement "FileOpen $0 $EXEDIR\${LIC_NAME1} r".
Any idea? Thanks for your help!
-----------------------------
!define LIC_NAME1 "..\doc\eula\da-DK.rtf"
!define LIC_NAME2 "..\doc\eula\de-DE.rtf"
!define LIC_NAME3 "..\doc\eula\el-GR.rtf"
; License page
!define MUI_LICENSEPAGE_CHECKBOX
!define MUI_PAGE_CUSTOMFUNCTION_SHOW addLicense
!insertmacro MUI_PAGE_LICENSE "..\doc\eula\en-US.rtf"
LangString Denmark ${LANG_FRENCH} "Denmark"
LangString Germany ${LANG_FRENCH} "Germany"
LangString Greece ${LANG_FRENCH} "Greece"
Function addLicense
ClearErrors
; Display EULA base on user's selection
${If} $Country S== $(Denmark)
FileOpen $0 $EXEDIR\${LIC_NAME1} r
${ElseIf} $Country S== $(Germany)
FileOpen $0 $EXEDIR\${LIC_NAME2} r
${ElseIf} $Country S== $(Greece)
FileOpen $0 $EXEDIR\${LIC_NAME3} 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
Please see code below.
I am using the addLicense from the forum to display EULA file according to user's selection.
The problem I am having is that: it always display the default file (en-US).
I know for a fact that it went to the right country comparison in the If/ElseIf statements by using MessageBox to verify.
Seem like it couldn't find the file in the statement "FileOpen $0 $EXEDIR\${LIC_NAME1} r".
Any idea? Thanks for your help!
-----------------------------
!define LIC_NAME1 "..\doc\eula\da-DK.rtf"
!define LIC_NAME2 "..\doc\eula\de-DE.rtf"
!define LIC_NAME3 "..\doc\eula\el-GR.rtf"
; License page
!define MUI_LICENSEPAGE_CHECKBOX
!define MUI_PAGE_CUSTOMFUNCTION_SHOW addLicense
!insertmacro MUI_PAGE_LICENSE "..\doc\eula\en-US.rtf"
LangString Denmark ${LANG_FRENCH} "Denmark"
LangString Germany ${LANG_FRENCH} "Germany"
LangString Greece ${LANG_FRENCH} "Greece"
Function addLicense
ClearErrors
; Display EULA base on user's selection
${If} $Country S== $(Denmark)
FileOpen $0 $EXEDIR\${LIC_NAME1} r
${ElseIf} $Country S== $(Germany)
FileOpen $0 $EXEDIR\${LIC_NAME2} r
${ElseIf} $Country S== $(Greece)
FileOpen $0 $EXEDIR\${LIC_NAME3} 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