简体   繁体   English

在完成页面中禁用后退按钮

[英]Disable back button in finish page

For my installation i have added new custom page. 对于我的安装,我添加了新的自定义页面。 It comes after MUI_PAGE_INSTFILES. 它出现在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. 页面自定义之前, InstallPageCreate checkinstdir不存在,并且完成页面没有启用后退按钮。

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. 因此,如果没有为我的setup.exe传递命令行,则在MUI_PAGE_INSTFILES之后,完成页面到来。如果用户单击后退按钮,则再次显示MUI_PAGE_INSTFILES,文件将复制到安装目录。 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)? 它是在宏MUI_PAGE_INSTFILES(nsis builtin宏)中完成的吗?

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; makensis.exe(CEXEBuild :: ProcessPages)中有一些代码在页面上设置了一个标志:p-> flags | = PF_BACK_ENABLE; and code in UI.c checks this flag. 和UI.c中的代码检查此标志。 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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