通过代码将卸载注册表项设置为条件

编程入门 行业动态 更新时间:2024-10-26 16:29:42
本文介绍了通过代码将卸载注册表项设置为条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何通过以下方法使Inno Setup禁用 CreateUninstallRegKey 代码?

How do you make Inno Setup disable CreateUninstallRegKey via code?

我在Inno Setup中创建的 setup.exe 文件接受参数,例如:

My setup.exe file created in Inno Setup accepts parameters, e.g.:

setup.exe -a

setup.exe -b

如果提供了-a参数,则启用CreateUninstallRegKey;如果提供了-b参数,则禁用CreateUninstallRegKey.

If -a parameter is supplied, then enable CreateUninstallRegKey, or if -b parameter is supplied, then disable CreateUninstallRegKey.

反正是通过代码设置CreateUninstallRegKey还是我必须先创建一个函数然后在脚本部分中调用该函数?

Is there anyway to set CreateUninstallRegKey via code or do I have to make a function then call the function in script section?

此帮助页面说明了有关使用{code:...}常量的信息,但不幸的是,我遇到了此错误:

This help page explains about using {code:...} constants, but unfortunately I got this error:

谢谢

推荐答案

请勿使用{code:}表达式将值传递给布尔类型指令.这样做:

Do not use the {code:} expression for passing values to Boolean type directives. Do it this way:

[Setup] AppName=My Program AppVersion=1.5 DefaultDirName={pf}\My Program CreateUninstallRegKey=NeedsUninstallRegKey [Code] function CmdLineParamExists(const Value: string): Boolean; var I: Integer; begin Result := False; for I := 1 to ParamCount do if CompareText(ParamStr(I), Value) = 0 then begin Result := True; Exit; end; end; function NeedsUninstallRegKey: Boolean; begin Result := CmdLineParamExists('-a'); end;

更多推荐

通过代码将卸载注册表项设置为条件

本文发布于:2023-11-03 14:37:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555380.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:设置为   注册表   条件   代码

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!