Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9161661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:01:08+00:00 2026-06-17T14:01:08+00:00

I have just started using inno setup, and it seems to work well. However,

  • 0

I have just started using inno setup, and it seems to work well. However, when I run the installer with the app already installed it reinstalls. I would like to give the user to uninstall. Is this possible, and if so, how can it be done?

To be specific, I have written a game for a homework assignment. I made an installer using inno setup. The app installs fine and can be uninstalled using the control panel, but my professor would like to be able to uninstall the application by re-running the installer and choosing an uninstall option. This will save him time since he has about 50 of these assignments to mark.

Thanks,

Gerry

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:01:09+00:00Added an answer on June 17, 2026 at 2:01 pm

    The next script will make the following options form when the application is already installed on the target system when the setup is started:

    enter image description here

    When the user clicks Repair button, the setup is normally started. When user clicks the Uninstall button, the previously installed application is uninstalled. When user closes that form, nothing happens.

    Here is the script (don’t forget to specify, ideally some unique, value for the AppId setup directive in your script):

    [Setup]
    AppName=My Program
    AppVersion=1.5
    AppId=1C9FAC66-219F-445B-8863-20DEAF8BB5CC
    DefaultDirName={pf}\My Program
    OutputDir=userdocs:Inno Setup Examples Output
    
    [CustomMessages]
    OptionsFormCaption=Setup options...
    RepairButtonCaption=Repair
    UninstallButtonCaption=Uninstall
    
    [Code]
    const
      mrRepair = 100;
      mrUninstall = 101;
    
    function ShowOptionsForm: TModalResult;
    var
      OptionsForm: TSetupForm;
      RepairButton: TNewButton;
      UninstallButton: TNewButton;
    begin
      Result := mrNone;
      OptionsForm := CreateCustomForm;
      try
        OptionsForm.Width := 220;
        OptionsForm.Caption := ExpandConstant('{cm:OptionsFormCaption}');
        OptionsForm.Position := poScreenCenter;
    
        RepairButton := TNewButton.Create(OptionsForm);
        RepairButton.Parent := OptionsForm;
        RepairButton.Left := 8;
        RepairButton.Top := 8;
        RepairButton.Width := OptionsForm.ClientWidth - 16;
        RepairButton.Caption := ExpandConstant('{cm:RepairButtonCaption}');
        RepairButton.ModalResult := mrRepair;
    
        UninstallButton := TNewButton.Create(OptionsForm);
        UninstallButton.Parent := OptionsForm;
        UninstallButton.Left := 8;
        UninstallButton.Top := RepairButton.Top + RepairButton.Height + 8;
        UninstallButton.Width := OptionsForm.ClientWidth - 16;
        UninstallButton.Caption := ExpandConstant('{cm:UninstallButtonCaption}');
        UninstallButton.ModalResult := mrUninstall;
    
        OptionsForm.ClientHeight := RepairButton.Height + UninstallButton.Height + 24;
        Result := OptionsForm.ShowModal;
      finally
        OptionsForm.Free;
      end;
    end;
    
    function GetUninstallerPath: string;
    var
      RegKey: string;
    begin
      Result := '';
      RegKey := Format('%s\%s_is1', ['Software\Microsoft\Windows\CurrentVersion\Uninstall', 
        '{#emit SetupSetting("AppId")}']);
      if not RegQueryStringValue(HKEY_LOCAL_MACHINE, RegKey, 'UninstallString', Result) then
        RegQueryStringValue(HKEY_CURRENT_USER, RegKey, 'UninstallString', Result);
    end;
    
    function InitializeSetup: Boolean;
    var
      UninstPath: string;
      ResultCode: Integer;  
    begin
      Result := True;
      UninstPath := RemoveQuotes(GetUninstallerPath);
      if UninstPath <> '' then
      begin
        case ShowOptionsForm of
          mrRepair: Result := True;
          mrUninstall: 
          begin
            Result := False;
            if not Exec(UninstPath, '', '', SW_SHOW, ewNoWait, ResultCode) then
              MsgBox(FmtMessage(SetupMessage(msgUninstallOpenError), [UninstPath]), mbError, MB_OK);
          end;
        else
          Result := False;
        end;
      end;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just started using android, and have about 5 layout files finished. However,
I have just started using core data. I want to setup a pre-populated db.
I have just started using NSIS . It works very well but I find
I have just started using grails and installed the spring-security and spring-security-ui plugins. I
At work we have just started using CodedUI, in our product there are a
I have just started using UIDatePicker in my iPad app, but is there a
we have just started using a git account of our Django website project so
I have just started using RSpec and I copied the very simple test on
I have just started using flexigrid and wanted to use the resource string to
i have just started using Moq ver (3.1) and i have read blogs and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.