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 8312469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:10:34+00:00 2026-06-08T20:10:34+00:00

How do I detect whether the user already installed the software and if so,

  • 0

How do I detect whether the user already installed the software and if so, how to offer the possibility of removing the old version?

I have written some lines to check that. Is that correct for now? If this is correct, then how can I let the user choose whether he wants to continue the installation or uninstall the old version?

#define UNINSTKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\setupname_is1"

var
  uninstallPath: string;

function InitializeSetup: Boolean;
begin
  if (RegQueryStringValue(HKLM,'{#UNINSTKEY}','UninstallString',uninstallPath)) and
     (uninstallPath <> '') and (fileexists(uninstallPath)) then
  begin
    Result :=
      (MsgBox(CustomMessage('NotVerifiedVersionFound'), mbConfirmation,
              MB_YESNO or MB_DEFBUTTON2) = IDYES);
  end;
  { ... }
end;
  • 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-08T20:10:36+00:00Added an answer on June 8, 2026 at 8:10 pm

    You could use Craig McQueen’s solution originally posted here: InnoSetup: How to automatically uninstall previous installed version?

    function GetUninstallString: string;
    var
      sUnInstPath: string;
      sUnInstallString: String;
    begin
      Result := '';
      sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{{A227028A-40D7-4695-8BA9-41DF6A3895C7}_is1'); { Your App GUID/ID }
      sUnInstallString := '';
      if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
        RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
      Result := sUnInstallString;
    end;
    
    function IsUpgrade: Boolean;
    begin
      Result := (GetUninstallString() <> '');
    end;
    
    function InitializeSetup: Boolean;
    var
      V: Integer;
      iResultCode: Integer;
      sUnInstallString: string;
    begin
      Result := True; { in case when no previous version is found }
      if RegValueExists(HKEY_LOCAL_MACHINE,'Software\Microsoft\Windows\CurrentVersion\Uninstall\{A227028A-40D7-4695-8BA9-41DF6A3895C7}_is1', 'UninstallString') then  { Your App GUID/ID }
      begin
        V := MsgBox(ExpandConstant('Hey! An old version of app was detected. Do you want to uninstall it?'), mbInformation, MB_YESNO); { Custom Message if App installed }
        if V = IDYES then
        begin
          sUnInstallString := GetUninstallString();
          sUnInstallString :=  RemoveQuotes(sUnInstallString);
          Exec(ExpandConstant(sUnInstallString), '', '', SW_SHOW, ewWaitUntilTerminated, iResultCode);
          Result := True; { if you want to proceed after uninstall }
          { Exit; //if you want to quit after uninstall }
        end
        else
          Result := False; { when older version present and not uninstalled }
      end;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed one application in which i have to detect whether user has
Consider the following statement : if(UserAgent.matches(iPhone)) I have to detect whether the user is
I am wondering if it is possible to detect whether the user exits the
I need to be able to detect whether the current language my user is
I need to detect whether the user has pressed the dot key in the
I'm trying to detect whether a user quickly presses a keyboard key twice, a
Is it possible to detect whether the user has registered a facebook/twitter/live/linkedin account in
I have TreeView Populating from Database And I am Trying to detect the user
I have push notifications enabled for my app and I detect whether the app
I would like to detect whether the user has pressed Enter using jQuery. How

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.