InstallShield Tips and Techniques

October 23, 2011

Creating additional Destination Folder dialog

Filed under: Reference Materials — shieldmaster @ 12:39 am

For some projects I occasionally find that it is necessary to prompt the user for a destination location in addition to the default INSTALLDIR.


For example, what if I want to confirm the Java JRE directory that I found installed is the one the user wants to associate with their applications (quite possible they certified an older JRE version – not the most current). The only reference I found on how to do this was for InstallScript MSI project, but I am working solely in Basic MSI projects.

In order to provide the end user with the same Browse to a folder dialog used in a default installation, the following steps can be followed for use in a Basic MSI InstallShield project:

  1. Create a new Directory that will be used to hold the JRE directory found – and will be displayed in the Browse directory. Since I have never, (repeat never) mastered the Directory Table (using Direct Editor), here is how I approach it. I create a new component (delete if afterwards) and select the dropdown to create a new directory entry.


    Now a directory browse dialog is presented:

    Using the INSERT key, create a new directory “JRE Path”

    Now rename the Directory Identifier to be all CAPS, such as “JRE_PATH” – this will be the MSI Property that we will use as our Directory. Now we need to create some dialog screens to display and allow the user to browse to a new directory.


    Go to the Dialogs section, and export a dialog that we will need to “repurpose” for our needs. For our example, we are going to export the dialog “AdminChangeFolder” by selecting the dialog and right-clicking. Export the dialog ISD to a folder you can retrieve it from later.


    Now rename the original “AdminChangeFolder” to “AdminChangeFolder_ORIG” to preserve it. I do this because even though I tried to rename the dialog during export, it always appears with the same name – overwriting the original.


    Now import back the “AdminChangeFolder” dialog by right-clicking on the “All Dialogs” title. The repository appears:

    Browse to the saved dialog, and select it – it will appear in the repository as shown here:


    Select OK and the dialog will appear back in your listing of dialogs.

    WARNING: if this popup dialog appears:

    You must select the red conflict item and select “Overwrite”, like this:

    What is happening is that the internal bitmaps are being exported as “NewBinary1” files and stored in the same directory as the project ISM file (Hint: look for a file “NewBinary1” and copy as “NewBinary.jpg” and you will see the banner bitmap). Here is the result you might find – the banner bitmap points to a file “NewBinary1” – not to the original file location:


    The solution is to replace the “File Name” with the original value, such as: <ISProductFolder>\Redist\Language Independent\OS Independent\IsDialogBanner.ibd (With InstallShield v10.5 it will ripple this NewBinary1 reference to ALL of your dialogs, so you may have to create a new InstallShield project to determine the original file values. If this happens, then you either must go to each dialog and correct it, or you can open the Direct Editor, go to the “Binary” table and alter the displayed value for NewBinary1,


    Now rename “AdminChangeFolder_ORIG” to “JavaChangeFolder”.


    We are going to leave this dialog and create a new dialog “JavaDirectory” that will display the Java JRE directory along with a “Change” button.

    Here is a sample of one I created:


    Essentially it contains a text box, a PathEdit box and a Change pushbutton. The property associated with the PathEdit box is “JRE_PATH”.

    We want the user to see a directory browse button when they hit the ‘Change’ pushbutton, so we need to switch to the ‘Behavior’ to edit the JavaDirectory dialog behavior. On the Change pushbutton (titled ‘PushButton1’ add an Event “SpawnDialog” with the argument “JavaChangeFolder” and a condition of 1 – as shown here:


    Now change to the dialog “JavaChangeFolder” and in the dialog view, change ALL of the property values from “TARGETDIR” to the property “JRE_PATH” as shown:


    Then you will need to switch to the ‘Behavior’ view and alter the event OK and change the argument from “TARGETDIR” to “JRE_PATH”

    FINALLY – go to the project Property Manager section and delete the property “JRE_PATH” – if you don’t the path will be incorrectly set as “0” and your project will hang during the starting and fail with error 1603!! For some reason, this value will keep appearing during your development, so you may need to double check it a couple of times.

    Now, to prime the directory “JRE_PATH” you can setup an Custom Action to grab the environment variable JAVA_HOME and prime the directory with this value, or you can execute a Custom Action InstallScript that will evaluate the machine and set this MSI Property (MsiSetProperty xxx) to a directory value. Here is a sample display of the dialogs when running:





    Hope this helps!











  1. Hi Shieldmaster,

    I’m trying to do something similar to this using ClickOnce. I use Basic MSI for all installs.

    I need to be able to set a component’s Destination dynamically.

    Version =
    DestinationFolder will need to be set as Destination.

    So for example as the builds go, i need to have c:\program. and c:\program.

    How do i accomplish this?

    Larry Paseornek

    Comment by Larry Paseornek — November 23, 2011 @ 1:19 pm

    • Larry

      If I understand your question, you want each MSI that you build to have a INSTALLDIR value set dynamically. You would approach this via Build Automation toolset that allows you to dynamically alter the INSTALLDIR value before the MSI is built. Look for examples within the InstallShield forums.

      Hope this answers your question.


      Comment by shieldmaster — November 28, 2011 @ 10:59 pm

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at

%d bloggers like this: