Skip to content
⌘ NSIS Forum Archive

Newbie help - changing install drive in MUI

6 posts

mjfirley#

Newbie help - changing install drive in MUI

Hi,

OK, this is probably SO old hat to the experienced folks but I can't seem to find a direct answer so here goes:

I have an install script that works a treat. I use MUI_PAGE_DIRECTORY to allow the user to specify where the installer will write its files. I'm using this so they can direct the output to a drive other than C:

The bad thing is that the way I currently have it written, the user can rename the directory (which I don't want) as well as select a different drive (which I do want).

So far as I can see, I seem to have two ways out of this:

1. Truncate the install directory name to C:, then append via StrCopy the full path name at a later point in the code. But then I need to understand how to change the wording on the default panel.

2. Find a sample custom dialog if it's available.


Thoughts and (positive) suggestions would be appreciated.

Thanks
bnicer#
This changes the default label and text.
Function DirectoryPageShow
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $1 $0 1006
SendMessage $1 ${WM_SETTEXT} 0 "STR:The installation requires you to select a drive."
GetDlgItem $1 $0 1020
SendMessage $1 ${WM_SETTEXT} 0 "STR:Target Drive"
FunctionEnd
Afrow UK#
The easiest way is to set the directory text box to read-only so the user can only browse for a folder:
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.


Stu
mjfirley#
I knew I wasn't going to make myself clear

What I have is an installer that calls an MUI page:
$INSTDIR = "MandatoryName"

!insertmacro MUI_PAGE_DIRECTORY
; Use the above option to give user a choice as to where
; the install is located

Right now, that produces a dialog that asks the user to select an install directory and defaults to:

C:\MandatoryName

What I want to do instead is to allow the MUI_PAGE_DIRECTORY to specify not the directory, but the drive so that the dialog essentially becomes:

+----------------------------------+
| Select a drive to install to +
| +---+ +
| |C: | +
| +---+ +
| Continue Cancel +
+----------------------------------+

Now I know it's possible to write a dialog but since all my other pages are MUI format, I was hoping to find a way to control MUI_PAGE_DIRECTORY.

I've done a fair amount with programming NSIS, but I confess that I'm a procedural language junkie (read "old guy") so the dialog management is a bit mysterious.

Do you have a suggestion on how to fix this or a place where I can get better MUI documentation and learn more?

Thanks,
Mark
Afrow UK#
Nope, for what you want it would be much better to do a custom page with a list box containing the drives (use GetDrives).
Someone has already done this on the forum once or twice.

Stu
Red Wine#edited
Originally posted by Afrow UK
Nope, for what you want it would be much better to do a custom page with a list box containing the drives (use GetDrives).
Someone has already done this on the forum once or twice.

Stu
Someone might be me 😉 here's the link,