该程序我正在构建一个安装程序,使用注册表项来存储用户设置。现在我已经将它设置为在卸载程序时删除所述注册表文件,但我希望能够为用户提供在卸载时保留或删除注册表文件的选项。
我不是最好的脚本编写者/程序员,所以答案越简单越好。
我的注册表/卸载目前看起来像这样。
[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"
答案 0 :(得分:19)
InnoSetup没有任何条件卸载检查参数,因此您必须自己执行此操作。因此,您需要删除会自动删除注册表项的uninsdeletekey
标志,并且在卸载过程结束时,您可以询问用户是否要删除该密钥(以某种有意义的消息方式)并手动删除密钥。以下脚本在卸载后步骤执行此操作,即成功卸载应用程序的时间。您可以关注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;