Skip to content
⌘ NSIS Forum Archive

DirRequest

3 posts

volpolo#

DirRequest

For my installer, i want the user choose the installation path by Browse button; NOT by input.

May i disable input in MUI_PAGE_DIRECTORY and in a page created with INSTALLOPTIONS ?

Thanks for help.

By
Animaether#
Both - yes. In both cases, get the control, and disable it.

For the standard MUI_PAGE_DIRECTORY, adjust your code like this:

Add a callback function for when the page gets shown

!define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowFunc
!insertmacro MUI_PAGE_DIRECTORY
In the callback function, get the control and disable it

Function ShowFunc
; Get the inner (MUI) dialog
FindWindow $0 "#32770" "" $HWNDPARENT

; Get the directory edit field
GetDlgItem $1 $0 0x3fb

; Disable the field
EnableWindow $1 0
FunctionEnd
If you're wondering where the 0x3fb comes from - download WinSpy++ - it allows you to drag&drop a crosshair onto any control and gets its Control ID (among many other goodies).