Hi all,
First, my apologies for the translation (Spanish to English)
I've been doing a project installing a palette interface OpenDCL and I made a setup project in InnoSetup for distribution. The project set up the silent installation of OpenDCL Runtime:
#define OpenDCLRuntime "OpenDCL.Runtime"
#define OpenDCLRuntimeVer "6.0.2.5"
#define OpenDCLRuntimeAndVersion OpenDCLRuntime + "." + OpenDCLRuntimeVer + ".msi"
....
[Components]
Name: "opendcl"; Description: {cm:CompOpendcl};Types: full; Flags: dontinheritcheck
[Files]
;;-------------------------- OpenDCL ------------------------------------------------
Source: "INSTALACION\{#OpenDCLRuntimeAndVersion}"; DestDir: {tmp}; Flags: deleteafterinstall; Components: opendcl;
[Run]
Filename: msiexec.exe; Parameters: "/q /i ""{tmp}\{#OpenDCLRuntimeAndVersion}""" ; WorkingDir: {tmp};StatusMsg: Instalando {#OpenDCLRuntimeAndVersion}; Flags: waituntilterminated runminimized; Check: CheckOpenDCLRuntimeInstalled; Components: opendcl; AfterInstall: DCLRuntimeInstalledOK
In this part of the call to a function; Check: CheckOpenDCLRuntimeInstalled, to see if OpenDCL Runtime is installed and if so know which version is installed also to give a notice to the user. If the installed version is greater or equal, not installing OpenDCLRuntime run.
Function:
//----------------------- CheckOpenDCLRuntimeInstalled ----------------------------
// Chequea si puede instalarse OpenDCL Runtime en el equipo
function CheckOpenDCLRuntimeInstalled: Boolean;
var
sVerI, strVerInstalled, Path: string;
begin
Result := true;
if DirExists(ExpandConstant('{cf}\Opendcl')) then
begin
Path:= ExpandConstant('{cf}\Opendcl');
end else if DirExists(ExpandConstant('{cf32}\Opendcl')) then
begin
Path:= ExpandConstant('{cf32}\Opendcl');
end;
if Path <> '' then
begin
Path:= Path + '\OpenDCL.18.arx';
if FileExists(Path) then
begin
if GetVersionNumbersString(Path, strVerInstalled) then
begin
sVerI := ExpandConstant('{#OpenDCLRuntimeVer}');
if strVerInstalled >= sVerI then
MsgBox('Can not install OpenDCLRuntimeAndVersion} + # 13 +
'because there is already a version equal or higher {#OpenDCLRuntime}.' + strVerInstalled + #13 +
'installed on this computer.'
, mbInformation, mb_Ok)
Result := false;
end;
end
end;
end;
I wonder if I can find out if Windos Registry OpenDCL Runtime is installed and the installed version. I think it would be a more reliable way of obtaining this information.
You can see the project at:
http://www.hispacad.com/foro/viewtopic.php?f=12&t=39544 (http://www.hispacad.com/foro/viewtopic.php?f=12&t=39544)
greetings and thanks.
There is no reliable way to simply check for a registry key. You would need to duplicate the very complicated work that msiexec does searching through the Windows Installer database. I recommend to leave that job to msiexec.
Thanks Owen,
We'll leave the code like this.
I noticed that when installing OpenDCL Runtime, the installer detects if there is a later version and the advice, but I wanted to check it with the code to tell the user versions.
One more question:
Is there a way to download the latest stable version for the installer always install the latest version.
I know this is complicated because the installer should download it from the internet and the user may not have internet connection but can search for alternatives.
It's always the same download link? : (http://opendcl.com/go?runtime) or may change in the future.
again my apologies for the translation.
Quote from: garcigj on September 18, 2012, 11:02:23 AM
It's always the same download link? : (http://opendcl.com/go?runtime) or may change in the future.
Yes, it will always be the same.