I just recently installed Inno Setup on my computer, I use to use it to package my software setup together for distribution. Inno Setup is so well designed, it has a Wizard to prepare your setup and if you want to add something tricky to your setup. You can also write code scripts to do certain things and best of all it’s free!

The language that is used for scripting is Pascal, this was one of the first language you learn when learning how to program.

Anyways I was able to write a small code in Inno Setup to check the Windows Registry if a particular Microsoft .NET Framework was installed before the user can resume installation. Below is a very basic function, it takes in a string parameter for the framework version number and return a boolean value if the registry entry exists.

Feel free to use this code snippet, I will post more improvements as I go in the future.

 

function CheckDotNet(Version:String):Boolean;
begin
  Result := true;
  if RegKeyExists(HKEY_LOCAL_MACHINE,’SOFTWARE\Microsoft\NET Framework Setup\NDP\’ + Version) = false then
  begin
    MsgBox(‘You do not have Microsoft .NET Framework 3.5 install on this computer.’, mbConfirmation, MB_OK);
    Result := false;
  end;
end;

Shares