My requirement is to check for previous installation of SQL native Client 11, before installation and uninstall the previous version. I have been able to check for the previ
That's not a (Inno Setup) constant. That's a GUID. Remove the ExpandConstant
call.
And you need to split the uninstall string to a program path and its parameters.
var
P: Integer;
UninstallPath: string;
UninstallParams: string;
begin
{ ... }
{ In case the program path is quoted, because it contains spaces. }
{ (it's not in your case, but it can be, in general) }
if Copy(sUnInstallString, 1, 1) = '"' then
begin
Delete(sUnInstallString, 1, 1);
P := Pos('"', sUnInstallString);
end
else P := 0;
if P = 0 then
begin
P := Pos(' ', sUnInstallString);
end;
UninstallPath := Copy(sUnInstallString, 1, P - 1);
UninstallParams := TrimLeft(Copy(sUnInstallString, P + 1, Length(sUnInstallString) - P));
Exec(UninstallPath, UninstallParams, '', SW_SHOW, wWaitUntilTerminated, iResultCode);
{ ... }
end;