InstallShield: Where is the ‘Create New Folder’ button when browsing?

InstallShield users may have noticed that, in all the ‘select folder’ type dialogs, there is no ‘Create New Folder’ button. If the user wants to create one, he can only do it from Windows itself, or (in some dialogs) type it as text. This is because all these dialogs call the SelectDir() function when clicking Browse.

This is of course very inconvenient, I saw several uses complain about it, but the situation remains.

I came up with a solution, inspired by this KB Article (how to browse for files in InstallScript). Basically I created my own version of AskDestPath() dialog, and modified the behavior so when clicking Browse it will call a custom function i wrote, based on Windows API SHBrowseForFolder().

You can find the custom function on my GitHub here.

The only issue I have is that I cannot set the initial folder. This is a known drawback of this specific API function, and there is a known C++ workaround – but it cannot apply to InstallShield since it does not support pointers to functions (it crashes if you try).

Advertisements

InstallShield scripting: Create a list of distinct items from a given list

Recently I had a situation when I needed the ability to take a list of strings and eliminate duplicates.

Now, in all modern languages, this is a built-in capability or data structure – set() in Python, Distinct() in C#,  etc.

But InstallScript is too basic for that. Since we need dynamic arrays, all we have to work with is the LIST object. So, after some trial and error, I came up with this piece of code, which is quite efficient; the only downside is that the order of items is not kept – but in my case it didn’t matter.

Continue reading

A ‘browse for file’ dialog using InstallScript

InstallScript provides a built in SelectDir() function, allowing the user can select a directory. However there is no equivalent function to allow the user to select a file. Which is a problem if you want to implement custom dialogs that browse for files (e.g. a dialog that asks for a .pfx certificate file and its password).

As it happens, InstallShield provides a very good knowledge-base article about how to add such functionality, but it is very-well hidden; you have to use very specific keywords in order to find it… So, to save you some time – go ahead and use this link.

Setup Launcher Unicode has stopped working, part II

In the past I wrote about a possible InstallScript bug which may cause setup.exe to crash.

However we kept encountering the crash message here and there, although this time when you closed it, the installation process continued normally and finished successfully.

This turned out to be a very random problem which makes it difficult to generalize or reproduce.

Recently, one of my team member found a solution for it: Continue reading

Setup Launcher Unicode has stopped working

Recently we migrated one of our InstallScript MSI project to InstallShield 2013.
Everything went well, until our most recent build, which simply crashes mid-installation. The ‘Fault Module Name’ is ISSetup.dll, but that’s about all the comprehensive information I could get from the crash report.
After adding custom logging (essentially logging every line in our InstallScript code), the problem was found. It seems to be an InstallShield bug (confirmed also on InstallShield 2013 SP1).
Here is the code who caused the crash, and how I fixed it:

// This will cause a crash
FileCopy(szSourceDir ^ szFileName, szTargetDir);
// This will not cause a crash
FileCopy(szSourceDir ^ szFileName, szTargetDir ^ szFileName);