NSIS 卸载程序中可以有可选部分吗?

问题描述 投票:0回答:2

构建我的安装程序时,我可以让用户通过调用来选择要安装的部分

!insertmacro MUI_PAGE_COMPONENTS

如何在卸载程序中提供类似的功能?

我知道如何制作这些部分(感谢这个问题的答案)。我只是不知道如何让用户选择卸载其中的哪些部分。

nsis
2个回答
5
投票

您执行与安装程序中相同的操作,您只需要正确的卸载程序前缀:

MUI_UNPAGE_COMPONENTS

Section /o un.optional
SectionEnd

0
投票

我堆放了一件带有非可选部分的东西。

首先我有一个由 NSIS 创建的安装程序。因此,它会自动控制应用程序是否已安装在电脑上,然后运行卸载程序,但如果未安装,则运行安装程序。 卸载程序会删除安装程序附带的一些文件。但我刚刚添加了自定义卸载页面,用于删除下载的额外文件 我的自定义卸载页面的运行行为是正常卸载完成后,自定义卸载页面中会出现添加的复选框。

所以我想做的事情是,当我检查它时,它应该删除我将在另一个功能或同一自定义页面中的某个位置设置的文件。

你介意给我一个想法吗?

我的代码示例;

Function .onit
;there are something here of my codes
FunctionEnd

Section "requiremnts" SEC01
;there are something here of my codes
SectionEnd

Section "Main Section" SEC02
;there is installing files
SectionEnd

Section "AddionalICons" SEC03
;there are something here of my codes
SectionEnd

Section .Post SEC04
;there are something here of my codes
SectionEnd

Function un.onUninstSuccess
;there are something here of my codes
FunctionEnd

Section Uninstall SEC05
;there are files that uninstalling
SectionEnd

UninstPage custom un.CustomUninstall SEC06
UninstPage instfiles

Function un.CustomUninstall
  nsDialogs::Create 1018
  Pop $0

  ${If} $0 == error
    Abort
  ${EndIf}

   ${if} $chkBoxDeleteFiles == "1"
         Delete "$INSTDIR\file1.dll"
         Delete "$INSTDIR\file2.dll"
   ${Else}
    MessageBox MB_OK "DeleteFiles is not 1" ; Check if this message appears
   ${EndIf}

  nsDialogs::Show
FunctionEnd
© www.soinside.com 2019 - 2024. All rights reserved.