Skip to content
⌘ NSIS Forum Archive

How disable directory field on MUI_PAGE_DIRECTORY?

38 posts

anonym#

How disable directory field on MUI_PAGE_DIRECTORY?

I'm using MUI

How disable directory field on MUI_PAGE_DIRECTORY?

Thank you
Yathosho#
if i understand you correctly, this makes no sense at all. either leave the directory page or use it as is.
anonym#
What item_id of directory field?

Next code not work:

!define MUI_PAGE_CUSTOMFUNCTION_SHOW MyFuncDir
!insertmacro MUI_PAGE_DIRECTORY

Function MyFuncDir
FindWindow $hwnd "#32770" "" $HWNDPARENT
GetDlgItem ${TEMP} $hwnd 1202
EnableWindow ${TEMP} 0
FunctionEnd

Thank you
Joost Verburg#
See resource.h or use a resource hacker to view the dialogs in the Contrib\UIs folder.
superwan#
hello, I'm trying to do it to...

I do not completely understand what to do, and this code does not work...

can you mr anonym please give the complete code working ?
Afrow UK#
!define MUI_PAGE_CUSTOMFUNCTION_SHOW MyFuncDir
!insertmacro MUI_PAGE_DIRECTORY

Function MyFuncDir
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R0 1019
EnableWindow $R1 0
FunctionEnd
-Stu
superwan#
thx very much...

this deactivates the field, but, not the "browse" button --> I still can change the $INSTDIR

have you got the value of the "browse" button --> though I can really disable the choice ?
(I think with just this value I could now do it 😛 )




why doing this and not skipping this page ?
--> because of the "proceed" button... (uninstall or reinstall or install)
this page is juste before the instfiles page, so I have to show that you're going to install or uninstall (and not only display a next page)


---> because of the reinstallation :
you reinstall and I show where is your software, (I don't want them ta change the INSTDIR if they reinstall)
superwan#
up 😁

i'me certainly annoying, but this is the last thing missing to me to finish my installer...

the question is :




how to disable the "browse" button in the MUI directory page ???
DrO#
try this and then drag the finder over the browse button and look for the 'Control ID' once the window details have been found.

-daz
superwan#
well I'vbe done what you aksed me to do...

I have a control ID :
000003E9

and now ? 😛
because the control ID of the install dir text is
000003FB
and this is not the value I entered to disable it...
superwan#
this is the perfect code to disable directory page :

!define MUI_PAGE_CUSTOMFUNCTION_SHOW MyFuncDir
!insertmacro MUI_PAGE_DIRECTORY
...

Function MyFuncDir
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R0 1019
EnableWindow $R1 0
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R0 1001
EnableWindow $R1 0
FunctionEnd

thx to everybody !
Comperio#
Ok, I know this is a bit off topic, but I just have to ask:

A MUI DIRECTORY page basiclaly just has 2 options: a text field for a description and a place to enter a path. There are no other options a user can click on, etc. that will make the select direcotry part become usable. Which leads to ask why even bother displaying the page in the first place?

I'm sure you have your reasons; I'm just being curious...
superwan#
1) if you have already installed
if you lanch the installer (and the uninstaller too for me)
they can propose you to reinstall, and if you want to reinstall
you choose your components (add, remove)
you go now to the directory page


and with a disabled directory page you can announce where the software will be reinstalled-modified


for a difficulty reason, and too because it's not logical, I don't want them to change the install dir
---> disabling directory page


2) the directory page button is the install button...
So if you skip it, no more "install button"... just next buttons...
and it's more "clear" to disable the fields of the directory page than to change the buttons of another page



these are my reasons 😉


ps : I'll come back and give all my script file when the software will be released... 10th february 2005
aj kwak#

Function MyFuncDir
FindWindow $hwnd "#32770" "" $HWNDPARENT
nice truck with winspy.

but how do you find de window(here 32770) or 8002hex ?
DrO#
#32770 is a standard classname for all dialog windows created by windows. if you do the same over a messagebox you should see the classname is the same. but basically it's just how the OS is designed

-daz
sunil_muppirala#
i tried the code given by superwan

i still cant disable the browse button and the install location field.
pls help me out
Cerf#
Hello there, I recently posted This Thread and now I see, the page can be disabled, but how can I disable it dinamically? I mean, if installRegKey returns that there is a previous installation, then disable the controls, but if it's a fresh installation let the user choose.

Thanks!

Cërf.
kichik#
Why not simply skip the directory page if it's not needed? If you really want to disable it, add an if block around the above code:
!include LogicLib.nsh
#...
${If} $INSTDIR != ""
# disable
${EndIf}
dandaman32#
If you're using the $hwnd var, you need to declare it first:
Var hwnd
That could be the source of your problems.

-dandaman32
Cerf#
Thanks Hichik!
You're right, now my problem is that I can't seem to find out (and this is embarrasing) how to assign $INSTDIR a default value, when it's a fresh installation.

Thanks again, Cërf.
Animaether#
!include LogicLib.nsh
#...
${If} $INSTDIR != ""
  # disable controls here
  StrCpy $INSTDIR "c:\some\default\folder"
${EndIf} 
--

additional note: you don't have to convert from hex to dec. If WinSpy gives you e.g. the value 403, simply use 0x403 in your NSIS script instead of 1027.