Archive: PassDialog + Experience UI


PassDialog + Experience UI
  Hi all :D !

I write you for an little problem.
i use this bottom code and when i call SerialPageShow function , my .exe crash ! why ? please help me






>#Include
>!include LogicLib.nsh
>!include "XPUI.nsh"
>!include "Sections.nsh"
>!include "WinMessages.nsh"



>;-----------------------------------------
; General XPUI Settings
XPStyle off
>#Splash screen bmp
>!define IMG_NAME INST_Mobilegov_SERVER_.bmp
>#Skin
>!define XPUI_WANSIS_SKIN Bliss
>!define XPUI_WANSIS_HEADERIMAGE
>#Color Text (white)
>!define XPUI_TEXT_COLOR FFFFFF
>!define XPUI_TEXT_LIGHTCOLOR FFFFFF
>#Color Licence text and BG
>!define XPUI_LICENSEBKCOLOR "ffffff"
>!define XPUI_BRANDINGTEXT_COLOR_FG "000000"
>#define radio button use for license agreement
>!define XPUI_LICENSEPAGE_RADIOBUTTONS
>!define XPUI_ABORTWARNING
>!define XPUI_DISABLEBG
>!define UI "XPUI"



>;-----------------------------------------
;Installer Page(s)
>#page welcome 1
>!insertmacro XPUI_PAGE_WELCOME
>#license page
>LicenseLangString myLicenseData 1033 "license_English.txt"
>LicenseLangString myLicenseData 1036 "license_French.txt"
>!define MUI_PAGE_CUSTOMFUNCTION_SHOW ComponentsShow
>!insertmacro XPUI_PAGE_LICENSE "$(myLicenseData)"

>Page custom SerialPageShow SerialPageLeave

># install compoment page
>!insertmacro XPUI_PAGE_COMPONENTS
>#Directory installation
>!insertmacro XPUI_PAGE_DIRECTORY
>#Confirm install
>!insertmacro XPUI_PAGE_INSTCONFIRM
>#install files
>!insertmacro XPUI_PAGE_INSTFILES
>!insertmacro XPUI_PAGE_FINISH
>!insertmacro XPUI_PAGE_ABORT



>## Displays the serial dialog
>Function SerialPageShow

>!insertmacro MUI_HEADER_TEXT "Enter Serial Code" "Enter the software serial code to continue."

>PassDialog::Dialog Serial
>/HEADINGTEXT 'Please enter the serial code located on the software CD case...'
>/CENTER
>/BOXDASH 12 70 4 ''
>/BOXDASH 92 70 4 ''
>/BOXDASH 172 70 4 ''
>/BOXDASH 252 70 4 ''
>/BOX 332 70 4 ''

>Pop $R0 # success, back, cancel or error

>FunctionEnd

>Function SerialPageLeave

>## Pop values from stack
>Pop $R0
Pop $R1
Pop $R2
Pop $R3
Pop $R4


>## A bit of validation

>StrCpy '$5' '$R0-$R1-$R2-$R3-$R4$\r$\n'
>StrCpy $6 0

Loop:
>IntOp $6 $6 + 1
StrCmp$6 500 Bad ;1 more than the # serials in file
>Push $6 ;line number to read from
File/oname=$PLUGINSDIRserial.txt "Numbers.txt"
>Push "$PLUGINSDIR\serial.txt" ;text file to read
Call ReadFileLine
Pop$0 ;output string (read from file.txt)
>StrCmp $0 $5 Good
Goto Loop

Bad:
>MessageBox MB_OK|MB_ICONEXCLAMATION "The entered username or password is incorrect!"
>Delete "$PLUGINSDIR\serial.txt"
>Abort

Good:
>Delete "$PLUGINSDIR\serial.txt"
>FunctionEnd

>Function ReadFileLine
Exch$0 ;file
Exch
Exch$1 ;line number
Push$2
Push$3

FileOpen$2 $0 r
StrCpy$3 0
Loop:
>IntOp $3 $3 + 1
ClearErrors
FileRead$2 $0
IfErrors+2
StrCmp$3 $1 0 loop
FileClose$2

Pop$3
Pop$2
Pop$1
Exch$0

FunctionEnd
>
thx

please help me :'( !
you have any idea why this function crash with experience UI ?

Thx


Hi all :) !

It's good with this code :) ! But when i click on 'cancel' button, he call the function SerialPageLeave instead of display the popup cancel.





Name "Pass"
>OutFile "PassSerial.exe"


>## Include headers
>!include XPUI.nsh
>!include LogicLib.nsh

>!define XPUI_ABORTWARNING
>## Pages

#page welcome 1
>!insertmacro XPUI_PAGE_WELCOME
#license page
>!insertmacro XPUI_PAGE_LICENSE "license_English.txt"
Page custom SerialPageShow SerialPageLeave

#Directory installation
>!insertmacro XPUI_PAGE_DIRECTORY
#Confirm install
>!insertmacro XPUI_PAGE_INSTCONFIRM
#install files
>!insertmacro XPUI_PAGE_INSTFILES
>!define XPUI_FINISHPAGE_RUN
# disable cancel button in finish
>!insertmacro XPUI_PAGE_FINISH
#Abord popup confirmation
>!insertmacro XPUI_PAGE_ABORT

>!insertmacro XPUI_LANGUAGE English

>## Displays the serial dialog
>Function SerialPageShow

>;!insertmacro MUI_HEADER_TEXT "Enter Serial Code" "Enter the software serial code to continue."
;!insertmacro MUI_INSTALLOPTIONS_EXTRACT "serial.ini"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "serial.ini"

;!insertmacro MUI_INSTALLOPTIONS_DISPLAY "serial.ini"
>; Pop $R0 # success, back, cancel or error

>FunctionEnd

>Function .onInit

;Extract InstallOptions files
;$PLUGINSDIR will automatically be removed when the installer closes

InitPluginsDir
>!insertmacro MUI_INSTALLOPTIONS_EXTRACT "serial.ini"

>FunctionEnd

>## Validate serial numbers
>Function SerialPageLeave

## Pop values from stack
Pop $R0
Pop $R1
Pop $R2
Pop $R3
Pop $R4


## A bit of validation
>!insertmacro XPUI_INSTALLOPTIONS_READ $R0 "serial.ini" "Field 2" "State"
>!insertmacro XPUI_INSTALLOPTIONS_READ $R1 "serial.ini" "Field 3" "State"
>!insertmacro XPUI_INSTALLOPTIONS_READ $R2 "serial.ini" "Field 4" "State"
>!insertmacro XPUI_INSTALLOPTIONS_READ $R3 "serial.ini" "Field 5" "State"
>!insertmacro XPUI_INSTALLOPTIONS_READ $R4 "serial.ini" "Field 6" "State"


>;StrCpy '$5' '$R0-$R1-$R2-$R3-$R4'
>StrCpy '$5' '$R0-$R1-$R2-$R3-$R4$\r$\n'
>StrCpy $6 0

Loop:
>IntOp $6 $6 + 1
StrCmp$6 500 Bad ;1 more than the # serials in file
>Push $6 ;line number to read from
File/oname=$PLUGINSDIRserial.txt "Numbers.txt"
>Push "$PLUGINSDIR\serial.txt" ;text file to read
Call ReadFileLine
Pop$0 ;output string (read from file.txt)
>StrCmp $0 $5 Good
Goto Loop

Bad:
>MessageBox MB_OK|MB_ICONEXCLAMATION "The entered username or password is incorrect!"
>Delete "$PLUGINSDIR\serial.txt"
>Abort

Good:
>Delete "$PLUGINSDIR\serial.txt"
>FunctionEnd

>Function ComponentsPageShow

## Disable the Back button
GetDlgItem $R0 $HWNDPARENT 3
EnableWindow $R0 0

FunctionEnd

>Function ReadFileLine
Exch$0 ;file
Exch
Exch$1 ;line number
Push$2
Push$3

FileOpen$2 $0 r
StrCpy$3 0
Loop:
>IntOp $3 $3 + 1
ClearErrors
FileRead$2 $0
IfErrors+2
StrCmp$3 $1 0 loop
FileClose$2

Pop$3
Pop$2
Pop$1
Exch$0

FunctionEnd

>## Just a dummy section
>Section 'A section'
>SectionEnd
>
serial.ini



>***91;Settings***93;
>NumFields=10

>***91;Field 1***93;
>Type=Label
Text
=Label
Left=12
Right=265
Top=42
Bottom=61

>***91;Field 2***93;
>Type=Text
MaxLen=4
Left=18
Right=58
Top=70
Bottom=81

>***91;Field 3***93;
>Type=Text
MaxLen=4
Left=70
Right=110
Top=70
Bottom=81

>***91;Field 4***93;
>Type=Text
MaxLen=4
Left=120
Right=160
Top=70
Bottom=81

>***91;Field 5***93;
>Type=Text
MaxLen=4
Left=170
Right=210
Top=70
Bottom=81

>***91;Field 6***93;
>Type=Text
MaxLen=4
Left=220
Right=260
Top=70
Bottom=81

>***91;Field 7***93;
>Type=Label
Text=-
>Left=64
Right=66
Top=70
Bottom=78

>***91;Field 8***93;
>Type=Label
Text=-
>Left=114
Right=116
Top=70
Bottom=78

>***91;Field 9***93;
>Type=Label
Text=-
>Left=164
Right=166
Top=70
Bottom=78

>***91;Field 10***93;
>Type=Label
Text=-
>Left=214
Right=216
Top=70
Bottom=78
>
you have any idea please ?

nobody wants to help me :'(

I've just a last question, it's possible to past at next box when a box has 4 characters ?
Example : "aaaa" next box "aaaa" ...