inno setup 卸载注册表_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 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;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值