Inno Setup-卸载注册表删除选项 [英] Inno Setup - Uninstall Registry Removal Option

查看:807
本文介绍了Inno Setup-卸载注册表删除选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建用于安装程序的程序使用注册表项来存储用户设置.现在,我将其设置为在卸载程序时删除所述注册表文件,但是我希望能够为用户提供一个在卸载后保留或删除注册表文件的选项.

The program I'm building an installer for uses registry entries to store user settings. Right now I have it set to delete said registry files when the program is uninstalled, but I would like the ability to give users an option to either keep or delete the registry files upon uninstall.

我不是最好的脚本编写者/程序员,所以答案越简单越好.

I'm not the best scripter/programmer, so the simpler the answer, the better.

我的注册表/卸载当前看起来像这样.

My registry/uninstall currently looks like this.

    [Registry]
    Root: HKCU; Subkey: "Software\FFSPLIT Overlay Filter"; Flags: uninsdeletekey


    [UninstallDelete]  
    Type: filesandordirs; Name: "{app}\ffmpeg"
    Type: filesandordirs; Name: "{app}\OverlayData"
    Type: files; Name: "{app}\AForge.Controls.dll"
    Type: files; Name: "{app}\AForge.Imaging.dll"
    Type: files; Name: "{app}\AForge.Video.DirectShow.dll"
    Type: files; Name: "{app}\AForge.Video.dll"
    Type: files; Name: "{app}\AudioFilter.ax"
    Type: files; Name: "{app}\default.cfg"
    Type: files; Name: "{app}\DirectShowLib-2005.dll"
    Type: files; Name: "{app}\ffmpeg.exe"
    Type: files; Name: "{app}\FFSplit Overlay Filter.ax"
    Type: files; Name: "{app}\FFsplit.exe"
    Type: files; Name: "{app}\FFSplitOverlayManager.exe"
    Type: files; Name: "{app}\librtmp.dll"
    Type: files; Name: "{app}\msvcp100d.dll"
    Type: files; Name: "{app}\msvcr100d.dll"
    Type: files; Name: "{app}\NAudio.dll"
    Type: files; Name: "{app}\RegisterFilter.bat"
    Type: files; Name: "{app}\setting.cfg"
    Type: files; Name: "{app}\UNRegisterFilter.bat"
    Type: files; Name: "{app}\wavbuffer"
    Type: files; Name: "{app}\Micfilter.ax"

推荐答案

InnoSetup没有任何条件卸载检查参数,因此您必须自己执行此操作.因此,您需要删除uninsdeletekey标志,该标志将自动删除注册表项,并且在卸载过程结束时,您可以询问用户是否要删除该项(以某种有意义的消息方式)并手动删除该项.以下脚本在卸载后步骤(成功卸载应用程序的时间)之后执行此操作.您可以按照 commented version :

InnoSetup doesn't have any conditional uninstall check parameter, so you have to do this by yourself. So you need to remove the uninsdeletekey flag which would delete the registry key automatically and at the end of the uninstallation process you can ask user if he wants to delete that key (in some meaningful message way) and delete the key manually. The following script does this at the post uninstall step, what is the time when the application was successfully uninstalled. You can follow the commented version:

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

#define FilterRegKey "Software\FFSPLIT Overlay Filter"

[Registry]
Root: HKCU; Subkey: "{#FilterRegKey}"

[Code]
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usPostUninstall then
  begin
    if RegKeyExists(HKEY_CURRENT_USER, '{#FilterRegKey}') then
      if MsgBox('Do you want to delete the overlay filter registry key ?',
        mbConfirmation, MB_YESNO) = IDYES
      then
        RegDeleteKeyIncludingSubkeys(HKEY_CURRENT_USER, '{#FilterRegKey}');
  end;
end;

这篇关于Inno Setup-卸载注册表删除选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆