Executing UninstallString in Inno Setup

后端 未结 1 1120
别跟我提以往
别跟我提以往 2020-11-30 13:18

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

相关标签:
1条回答
  • 2020-11-30 14:01

    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;
    
    0 讨论(0)
提交回复
热议问题