NSIS: Forbidden to choose installation path and edit installation directory

introduction

How to prohibit users from modifying the installation directory when using the NSIS packager, there are two ways to do it.

Method 1: Comment or delete the installation directory selection page

;!insertmacro MUI_PAGE_DIRECTORY

Method 2: Add functions on the installation directory selection page

; 安装目录选择页面
!define MUI_PAGE_CUSTOMFUNCTION_SHOW mulu
!insertmacro MUI_PAGE_DIRECTORY

Function mulu
;禁用浏览按钮
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1001
EnableWindow $0 0
;禁止编辑目录
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1019
EnableWindow $0 0
FunctionEnd

Guess you like

Origin blog.csdn.net/BXD1314/article/details/126299936