简体   繁体   中英

NSIS - How to make "Install" button always to be enabled

I removed info for available space but the install button is still disabled when there is no enough space for the installation itself. I want to make "install" button always enabled. I tried this but with no success:

Function .onInit
  Call enableInstallBtn
FunctionEnd

Function enableInstallBtn
    GetDlgItem $0 $hWndParent 1 ; Get button handle
    EnableWindow $0 1
FunctionEnd

在此处输入图像描述

.onInit is executed before the UI exists. The documentation tells you to set dirverify to leave:

RequestExecutionLevel User
InstallDir $temp

!include MUI2.nsh
!include LogicLib.nsh

!define MUI_DIRECTORYPAGE_VERIFYONLEAVE
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE verifydir
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

Function verifydir
GetInstDirError $0
${If} $0 = 1
  MessageBox MB_IconStop "Invalid installation directory!"
  Abort
${EndIf}
FunctionEnd

Section
AddSize 999999999 ; I'm huge
SectionEnd

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