Jerry Dodge
Jerry Dodge

Reputation: 27286

Prompt to close only certain applications

I'm writing an installer using Inno Setup 5.5.6(u) for an application which consists of one Windows service application and one UI application, each their own stand-alone EXE. The installer offers an option to either install both the service and UI app, or just the UI app without the service. All this works fine.

The problem arises when the installer is running on an existing installation, the installer detects that the service is running. I do have code which explicitly stops the service before the update runs, but this other screen catches it before my code runs, and offers the user for Inno Setup to automatically end the process.

procedure CurStepChanged(CurStep: TSetupStep);
begin
  case CurStep of
    ssInstall: begin
      //Just before install starts
      if ServiceExists(SVC_NAME) then begin        
        StopMyService;
      end else begin
        ServiceWasRunning:= True;
      end;
      InstallMyService; //Ignores if already exists
    end;
    ssPostInstall: begin
      //Just after install finishes
      if ServiceWasRunning then begin
        StartMyService;
      end;
    end;
  end;
end;

Now I don't want to completely disable this detection - I only want to instruct the installer not to bother checking the service executable, but still check the UI executable.

How do I accomplish this?

Upvotes: 0

Views: 89

Answers (1)

Jerry Dodge
Jerry Dodge

Reputation: 27286

After poking around some more, I found the solution.

In the [Setup] section, add a line called CloseApplicationsFilter and set it to only the application filename(s) which you want it to detect. Initially, I thought this property would only accept extension wildcards for example *.exe but a full filename works too.

Upvotes: 1

Related Questions