inno-setup – 如何检查注册表项是否存在并退出设置
发布时间:2020-12-15 09:15:16 所属栏目:大数据 来源:网络整理
导读:我尝试制作安装文件以修补以前的程序.设置必须能够检查是否安装了以前的程序. 这是我无法使用的代码 ? [Code]function GetHKLM() : Integer;begin if IsWin64 then begin Result := HKLM64; end else begin Result := HKEY_LOCAL_MACHINE; end;end;function
我尝试制作安装文件以修补以前的程序.设置必须能够检查是否安装了以前的程序.
这是我无法使用的代码 ? [Code] function GetHKLM() : Integer; begin if IsWin64 then begin Result := HKLM64; end else begin Result := HKEY_LOCAL_MACHINE; end; end; function InitializeSetup(): Boolean; var V: string; begin if RegKeyExists(GetHKLM(),'SOFTWAREABCOptionSettings') then MsgBox('please install ABC first!!',mbError,MB_OK); end; 我的病情是 >必须检查RegKeyExists的32位或64位窗口 如何修改代码? **更新修复Wow6432Node问题.我尝试修改我的代码 [Code] function InitializeSetup: Boolean; begin // allow the setup to continue initially Result := True; // if the registry key based on current OS bitness doesn't exist,then... if IsWin64 then begin if not RegKeyExists(HKLM,'SOFTWAREWow6432NodeABCOptionSettings') then begin // return False to prevent installation to continue Result := False; // and display a message box MsgBox('please install ABC first!!',MB_OK); end else if not RegKeyExists(HKLM,'SOFTWAREABCOptionSettings' then begin // return False to prevent installation to continue Result := False; // and display a message box MsgBox('please install ABC first!!',MB_OK); end end; end; 解决方法
问题中更新的代码是错误的 – 除了在RegEdit中查看路径之外,你永远不应该使用Wow6432Node.
从您描述的行为来看,您实际上正在寻找一个32位应用程序.在这种情况下,无论Windows是32位还是64位,您都可以使用相同的代码;你是在思考原来的问题. 以下是更新后的问题中的更正代码: [Code] function InitializeSetup: Boolean; begin // allow the setup to continue initially Result := True; if not RegKeyExists(HKLM,'SOFTWAREABCOptionSettings') then begin // return False to prevent installation to continue Result := False; // and display a message box MsgBox('please install ABC first!!',MB_OK); end; end; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |