cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Bjarne_Nielsen
Level 2

Saving [INSTALLDIR] in registry

Hi all.

Sorry if this is a very noobish question, but I'm new to this.

Anyway, I'm trying to save and load the last Installdir to/from the registry.
So I made an entry in the registry like: HKLM->Software->[company name]->[InstallDir] and added a string key: Name=InstallPath, Data=[INSTALLDIR].

When I install the program for the first time, the selected installdir is saved correctly into this registry key. On subsequent installs, the key does not change, even if I select another install folder. Even worse, even if i select another install folder, the program is always installed to the folder I selected on the very first install.

So I must be missing something obvious, but what?

In the InstallScript we have a function like this


//*********//

function SetDefaultInstallDir(hMSI)

string defaultInstallDir,value;
number buffer;

begin
defaultInstallDir = PROGRAMFILES + "UniLock 2.0\\\\";
MsiSetProperty(ISMSI_HANDLE, "DEFAULTINSTALLDIR", defaultInstallDir);
end;

//*********//


I'm not sure, if we added this, or it's a standard thing.
It's activated on "Install UI Sequence" -> "After MigrateFeatureStates".

Any help very appreciated.

Sincerely
Bjarne Nielsen
Labels (1)
0 Kudos
(1) Reply
pratik2911
Level 3

You can use RegDBsetKeyValueEx function to update registry entries.
Modify your code to pass your INSTALLDIR to this function during each install.

You can get more details about RegDBsetKeyValueEx function in installshield help

regards,
Pratik
0 Kudos