Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inno Setup Optional Remove appdata\YourApp during uninstall?

I am using Inno Setup and I want to remove AppData\Local\MyApp during uninstall that the installer did not create but I want to give users an option to remove this data without a message box.

Here is an screen shot example of what I am trying to achieve.

enter image description here

Here are some examples that I have seen already.

How to clear user's app data folders with Inno Setup?

Can't delete the folder created in My Documents with Inno Setup

http://www.jrsoftware.org/ishelp/index.php?topic=uninstalldeletesection

http://www.codeproject.com/Questions/243529/Inno-Setup-ask-user-on-uninstall-if-they-want-to-k

How can my installer optionally delete some files it didn't initially create?

I want to be able to add a optional check box so if the user uninstalls the program they can remove this hidden data.. but if the users is only upgrading or plans to install later they can leave this field unchecked and not remove this generated data.

I must be missing something really simple but I just can't figure it out at the moment.

Thanks.

like image 732
David Eaton Avatar asked Mar 17 '15 21:03

David Eaton


1 Answers

Here is a sample to create msg box during uninstall-

`[Code]
 procedure CurUninstallStepChanged (CurUninstallStep: TUninstallStep);
 var
     mres : integer;
 begin
    case CurUninstallStep of                   
      usPostUninstall:
        begin
          mres := MsgBox('Do you want to Remove settings?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2)
          if mres = IDYES then
            DelTree(ExpandConstant('{userappdata}\Myapp'), True, True, True);
       end;
   end;
end;  `

You can change '{userappdata}\Myapp'as you prefer.

like image 111
Kushal Avatar answered Sep 28 '22 07:09

Kushal