cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Snoopstah
Level 7

Custom Dialog to select a file

I know this is a very broad question but I don't know where to start.

How do I create a cusom dialog box that allows me to select an individual file?

I would like it to be similar to DatabaseFolder which spawns the InstallChangeFolder dlg box. Except it needs to go one level further and allow me to select an individual file rather than just a folder.

Any help greatly appreciated.
Labels (1)
0 Kudos
(9) Replies
RobertDickau
Flexera Alumni

Assuming you're talking about Basic MSI, there's nothing built in that shows files; for one approach, perhaps see www.installsite.org > Windows Installer > Custom Actions > File Browse Dialog. I think there are also a couple of InstallScript examples of the same kind of thing.
0 Kudos
Snoopstah
Level 7

Thanks Robert, that's exactly the answer I was after. I'll convert my project to an InstallScript MSI and then work on developing the dialog.
0 Kudos
RobertDickau
Flexera Alumni

I don't think I've looked at that example, but you shouldn't have to convert the project (unless you want to, of course); I imagine it's a custom action just calls the GetOpenFileName or similar API function and feeds the selection back to your MSI project...
0 Kudos
Snoopstah
Level 7

I have it all working except for one small thing that is really frustrating.

My entire install is setup and working as long as the ProductName is set to "Default". The minute I change this name to reflect the actual product name, the dialog box edit text field in the dialog box does not update showing which file was selected.

I have seen a similar problem when a user selects a folder from a browse button into an edit text field. The property is correctly updated but not displayed in the edit text field on the dialog. The workaround for this is to launch a 2nd identical dialog box as the last action on the Change button.

Why is this required? How is the ProductName affecting this ???

Is this the only workaround?
0 Kudos
RobertDickau
Flexera Alumni

That doesn't make any sense; is the custom action code using FindWindow to look for a window with "Default" in the caption, for example?
0 Kudos
Snoopstah
Level 7

I am not 100% sure what is in the CA dll as it is from the installsite example you sent me to. I don't have the tools to view dll code. I have attached the relevant DLL.

I have had a similar issue with IS12 (although I have no idea if it was related to Default productname as I did not test that.) I create a new dialog with a simple EditText dialog box and the property set to [MYPATH]. There is a browse button that calls a browse DLL (similar to attached). The following action is to set the [MYPATH] value and the edit text field should be populated with the new value.

The property is definitely set correctly but the edit box does not display the updated value. If i click NEXT and then BACK, the edit box has bee "updated" to show the correct value.
0 Kudos
SherylSikora
Level 6 Flexeran
Level 6 Flexeran

I downloaded all of the source code for this dll from InstallSite and when looking at the "BrowseForFile.cpp" code, it is in fact looking for a dialog caption of "Default - InstallShield Wizard". You will need to change this and recompile the dll.
(If my reply answers a question you have raised, please click "ACCEPT AS SOLUTION".)
0 Kudos
Snoopstah
Level 7

Ahh fabulous. Thankyou. I will pass this on to our developers who can hopefully resove the problem.

Can this be changed to an InstallShield property such as [ProductName]? Or do they need to hardcode the product name in there?
0 Kudos
RobertDickau
Flexera Alumni

Calling MsiGetProperty with ProductName should do the trick.
0 Kudos