|
|
|
|
|
Dicas
|
|
Visual Basic (ActiveX/Controles/DLL)
|
|
|
Título da Dica: Detectando a versão do MDAC com o INNO SETUP
|
|
|
|
Postada em 15/5/2006 por ¨Hennyere¨
[Setup] AppName=MDAC AppVerName=MDAC DefaultDirName={pf}MDAC DisableStartupPrompt=true Uninstallable=false DisableDirPage=true OutputBaseFilename=MDAC
[Code]
procedure DecodeVersion( verstr: String; var verint: array of Integer ); var i,p: Integer; s: string; begin // initialize array verint := [0,0,0,0]; i := 0; while ( (Length(verstr) > 0) and (i < 4) ) do begin p := pos('.', verstr); if p > 0 then begin if p = 1 then s:= '0' else s:= Copy( verstr, 1, p - 1 ); verint := StrToInt(s); i := i + 1; verstr := Copy( verstr, p+1, Length(verstr)); end else begin verint := StrToInt( verstr ); verstr := ''; end; end;
end;
function GetMDACVersion(): String; var sVersion: String; begin sVersion := ''; GetVersionNumbersString( ExpandConstant('{cf}SystemAdomsado15.dll') , sVersion ); Result := sVersion; end;
// This function compares version string // return -1 if ver1 < ver2 // return 0 if ver1 = ver2 // return 1 if ver1 > ver2 function CompareVersion( ver1, ver2: String ) : Integer; var verint1, verint2: array of Integer; i: integer; begin
SetArrayLength( verint1, 4 ); DecodeVersion( ver1, verint1 );
SetArrayLength( verint2, 4 ); DecodeVersion( ver2, verint2 );
Result := 0; i := 0; while ( (Result = 0) and ( i < 4 ) ) do begin if verint1 > verint2 then Result := 1 else if verint1 < verint2 then Result := -1 else Result := 0;
i := i + 1; end;
end;
function InitializeSetup(): Boolean; begin
if CompareVersion( GetMDACVersion(), '2.60') < 0 then begin MsgBox( 'There is MDAC version: ' + GetMDACVersion() + ' it is necessary to install version 2.60.', mbInformation, MB_OK ); Result := false; end else Result := true; end;
|
|
|
|
|