PDA

View Full Version : Reference previous installdir, lock down installdir



naters
06-04-2018, 06:42 PM
Hello,

After looking at some example projects including Lock Directory, reading up some topics like Detect Previous Version, and reading a few related threads including this one (http://www.lindersoft.com/forums/showthread.php?42775-Possible-to-retrieve-current-installdir-from-prior-install&highlight=installdir), I still haven't been able to figure out how to get the installer to do one of two things.

Either:
1) Refer to the registry value "InstallPath" (%_SB_INSTALLDIR%) that I have the installer create in "HKEY_LOCAL_MACHINE\SOFTWARE\*My product*", which would then replace (or skip) the "Select Install Folder" dialog since an install directory has already been determined during a previous installation. This is my preferred choice.
or
2) Prevent users from picking a custom installation path themselves, thereby being forced to install to the path I've specified.

I may have not figured this out yet, despite the resources, because I'm quite new to this stuff and the answers didn't make enough sense to me to pull it off. I'm not a developer myself (quality assurance), I was merely handed the installer task by my company, so you may have to be gentle and be very specific. Hopefully someone can help me. :)

linder
06-05-2018, 03:16 AM
Hello,

We'll develop a demo for you and upload it later today.

Friedrich

naters
06-05-2018, 12:34 PM
Hello,

We'll develop a demo for you and upload it later today.

Friedrich

Sounds good! Thank you, Friedrich.

linder
06-06-2018, 05:17 AM
Okay, here we go. We have uploaded a demo for you:

http://www.lindersoft.com/projects/LockedFolder.zip

Please use your own Product GUID in Line 37. This will read the installation folder from a previously installed product. If the installer detects the installation, it sets the runtime variable %VAR_ALREADY_INSTALLED% to "1". In Line 58, we set the Dialog Label to DLG_SELECTFOLDER.

In Lines 62-64, if %VAR_ALREADY_INSTALLED% equals "1" (means: the product is already there), skip (hide) the Select Installation Folder dialog.

There are quite a few more ways to handle this. But does this one work for you?

Friedrich

naters
06-06-2018, 03:52 PM
Yes, thank you! That was very helpful and worked like a charm after I figured out that I had to define the DLG_SELECTFOLDER var in the Dialog section. :) Thanks again!

linder
06-07-2018, 03:48 AM
You are very welcome :)

Friedrich