只读取MUI_PAGE_DIRECTORY页面字段?

时间:2017-05-19 04:01:28

标签: nsis

是否可以在MUI_PAGE_DIRECTORY页面中只读取目标文件夹字段并禁用浏览按钮?

1 个答案:

答案 0 :(得分:2)

InstallDir "$ProgramFiles\Whatever"

!include MUI2.nsh
!include WinMessages.nsh
!insertmacro MUI_PAGE_WELCOME
!define MUI_PAGE_CUSTOMFUNCTION_SHOW RestrictDirPage
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English

Function RestrictDirPage
!if "${MUI_SYSVERSION}" >= 2.0
SendMessage $mui.DirectoryPage.Directory ${EM_SETREADONLY} 1 0
EnableWindow $mui.DirectoryPage.BrowseButton 0
!else
FindWindow $0 '#32770' '' $HWNDPARENT
GetDlgItem $1 $0 0x3FB
SendMessage $1 ${EM_SETREADONLY} 1 0
GetDlgItem $1 $0 0x3E9
EnableWindow $1 0
!endif
FunctionEnd