Делал на основе этого кода:
ReInstall.ini:
Код:
[Settings]
NumFields=3
[Field 1]
Type=Label
Left=0
Right=-1
Top=0
Bottom=24
Text=MyProg is already installed. Select the operation you want to perform and click Next to continue.
[Field 2]
Type=RadioButton
Left=30
Right=-1
Top=50
Bottom=58
State=1
Text=Reinstall MyProg
[Field 3]
Type=RadioButton
Left=30
Right=-1
Top=70
Bottom=78
Text=Uninstall MyProg
reinstall.nsi:
Код:
!include "MUI.nsh"
!define MUI_ABORTWARNING
;!!!!!!!!!!!!!!!
InstallDirRegKey HKLM "Software\Antaris\TestReInstall" "Install_Dir"
Name "TestReInstall"
OutFile "TestReInstall.exe"
InstallDir "$PROGRAMFILES\MyNSISTest\TestReInstall"
!insertmacro MUI_PAGE_WELCOME
Page custom PageReinstall
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
ReserveFile "ReInstall.ini"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
Function .onInit
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ReInstall.ini"
FunctionEnd
Section Files
SetOutPath "$INSTDIR"
;File "1.exe"
SectionEnd
Section -Post
;!!!!!!!!!!!!!!!
WriteRegStr HKLM "Software\Antaris\TestReInstall" "Install_Dir" "$INSTDIR"
WriteUninstaller "$INSTDIR\uninstall.exe"
SectionEnd
Function PageReinstall
!insertmacro MUI_HEADER_TEXT "Already Installed" "Choose the maintenance option to perform."
ReadRegStr $R0 HKLM "Software\Antaris\TestReInstall" "Install_Dir"
StrCmp $R0 "" 0 +2
Abort
StrCpy $R0 "2"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ReInstall.ini"
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "ReInstall.ini" "Field 2" "State"
StrCmp $R0 "1" 0 +1
StrCmp $R0 "2" 0 +2
StrCmp $R1 "1" reinst_done
ExecWait '$INSTDIR\uninstall.exe'
Quit
reinst_done:
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove MyProg?" IDYES +2
Abort
FunctionEnd
Section Uninstall
Delete "$INSTDIR\1.exe"
Delete "$INSTDIR\uninstall.exe"
RMDir "$INSTDIR"
DeleteRegKey HKLM "Software\Antaris\TestReInstall"
SectionEnd
.
Просто добавил лишний RadioButton который ничего не делает. В этом коде тот же косяк, "<Назад" и "Далее>" действуют одинаково.