PDA

View Full Version : Conditional Install


seanmoloney
02-09-2005, 08:31 AM
Hi Folks,

Apologies if this seems obvious, I only started using SF7 today...

I want to make an installation that will run only if a certain registry key exists on the user's system. This installation is intended as a service patch for owners of one of products, the idea being the patch installer won't run if they don't have the original installation installed.

Many Thanks,

Sean.

Brett
02-09-2005, 08:48 AM
Here is a sample of how you could accomplish this. Put this code into your On Startup event:

bKeyExists = Registry.DoesKeyExist(HKEY_CURRENT_USER,"Software\\My Company\\My Product");
if not bKeyExists then
Dialog.Message("Notice","Invalid installed version. Setup will now abort");
Application.Exit();
end

seanmoloney
02-09-2005, 09:26 AM
Thanks for your prompt reply Brett, the code you give above works a treat...