简体   繁体   中英

Disable back button in finish page

For my installation i have added new custom page. It comes after MUI_PAGE_INSTFILES. But before this custom page was not there. The problem is that after adding this custom page,it has effected finish page and finish page now has back button enabled.Before it was disabled(I have not done any coding before to disable back button). But after adding new custom page finish page has back button enabled.

I have below order of pages

!insertmacro MUI_PAGE_WELCOME

!insertmacro MUI_PAGE_LICENSE "${Stpath}read me.txt"

!define MUI_PAGE_CUSTOMFUNCTION_PRE wel_pre

!define MUI_PAGE_CUSTOMFUNCTION_LEAVE DirectoryPageLeave 

!insertmacro MUI_PAGE_DIRECTORY

!insertmacro MUI_PAGE_INSTFILES

Page custom InstallPageCreate checkinstdir

!define MUI_FINISHPAGE_RUN "$INSTDIR\setupx.exe"

!define MUI_FINISHPAGE_RUN_PARAMETERS ""

!define MUI_PAGE_CUSTOMFUNCTION_PRE welfinish

!define MUI_PAGE_CUSTOMFUNCTION_SHOW FinishPageShow 

!define MUI_PAGE_CUSTOMFUNCTION_LEAVE myleave

!insertmacro MUI_PAGE_FINISH

Before the line Page custom InstallPageCreate checkinstdir was not there and finish page does not had back button enabled.

After adding that custom page back button in finish page is enabled.The custom page is shown only when certain command line is passed to installer. So if no command line is passed for my setup.exe then after MUI_PAGE_INSTFILES, finish page comes.If user clicks on back button then again MUI_PAGE_INSTFILES is shown and files will copy to install directory. Also if that custom page appears then that page has back button disabled, which is proper. Also i need to know where this back button disable is done? Is it done in macro MUI_PAGE_INSTFILES(nsis builtin macro)?

So i need to disable back button in finish page. Please help

There is some code in makensis.exe (CEXEBuild::ProcessPages) that sets a flag on the page: p->flags |= PF_BACK_ENABLE; and code in UI.c checks this flag. To override this use the page show callback function:

Function InstallPageCreate
StartMenu::Init /autoadd "Dummy page"
StartMenu::Show
FunctionEnd

!include MUI2.nsh
!insertmacro MUI_PAGE_INSTFILES
Page custom InstallPageCreate
!define MUI_FINISHPAGE_RUN "$INSTDIR\setupx.exe"
!define MUI_FINISHPAGE_RUN_PARAMETERS ""
!define MUI_PAGE_CUSTOMFUNCTION_SHOW FinishPageShow 
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English

Function FinishPageShow
GetDlgItem $0 $HWNDPARENT 3
EnableWindow $0 0
FunctionEnd

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM