Piotr Surma
Piotr Surma

Reputation: 304

Disable silent and verysilent uninstall in Inno Setup

Is it possible to disable silent and verysilent uninstall in Inno Setup?

Upvotes: 2

Views: 4027

Answers (2)

Anto Joeis
Anto Joeis

Reputation: 1

Can use parameter like "/SP-, /SILENT, /VERYSILENT", So that every wizard page will disable or hidden. In innosetup click "Tool"-->"Parameter" and save the above parameters and build the application and run your test. Mostly this will help you for upload in microsoft app store. You can use the parameter in microsoft app store silent install parameters.

Upvotes: 0

Deanna
Deanna

Reputation: 24313

You can't disable it directly, but you can check if it's running in silent mode and display a message/exit during the InitializeSetup()/InitialiseUninstall() event functions.

function InitializeSetup(): Boolean;
begin
  // Default to OK
  result := true;

  // If it's in silent mode, exit
  if WizardSilent() then
  begin
    MsgBox('This setup doesn''t support silent installations.', mbInformation, MB_OK);
    result := false;
  end;
end;

Or for uninstall:

function InitializeUninstall(): Boolean;
begin
  // Default to OK
  result := true;

  // If it's in silent mode, exit
  if UninstallSilent() then
  begin
    MsgBox('This setup doesn''t support silent uninstallation.', mbInformation, MB_OK);
    result := false;
  end;
end;

(Untested air code)

If you want to silently (??? :o) rerun the setup again in non silent mode, you can use this inside the InitializeSetup if block:

ShellExecAsOriginalUser('', ExpandConstant('{srcexe}'), '', '',  SW_SHOWNORMAL, ewNoWait, 0);

Note that this will also drop any other parameters passed and prompt for elevation again.

Upvotes: 4

Related Questions