7

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.

Community
  • 1
  • 1
David Eaton
  • 564
  • 2
  • 10
  • 22
  • 1
    You are not missing anything simple. Unfortunately, [`this still aplies`](http://stackoverflow.com/q/7415457/960757) and you cannot create custom pages for that check box (without hacks shown in the linked thread). – TLama Mar 17 '15 at 21:48
  • 2
    What about using msg box? It is not the best but only option as uninstaller pages are not supported (see TLama's link)? – Slappy Mar 18 '15 at 05:42

1 Answers1

6

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.

Kushal
  • 605
  • 8
  • 29
  • Oldie but goodie. Was banging my head on desk trying to do this and way over thinking. Your method is simple and works great (even today). – Woody Jun 08 '21 at 22:59