Mel*_*bit 6 inno-setup pascalscript
我尝试制作安装文件来修补以前的程序。安装程序必须能够检查是否安装了以前的程序。
这是我无法使用的代码
[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(), 'SOFTWARE\ABC\Option\Settings')
then
MsgBox('please install ABC first!!',mbError,MB_OK);
end;
Run Code Online (Sandbox Code Playgroud)
我的条件是
RegKeyExists如何修改代码?
先感谢您。
**更新修复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, 'SOFTWARE\Wow6432Node\ABC\Option\Settings') then
begin
// return False to prevent installation to continue
Result := False;
// and display a message box
MsgBox('please install ABC first!!', mbError, MB_OK);
end
else
if not RegKeyExists(HKLM, 'SOFTWARE\ABC\Option\Settings' then
begin
// return False to prevent installation to continue
Result := False;
// and display a message box
MsgBox('please install ABC first!!', mbError, MB_OK);
end
end;
end;
Run Code Online (Sandbox Code Playgroud)
问题中更新的代码是不正确的——Wow6432Node除了在 RegEdit 中查看路径之外,您永远不应该在任何地方使用。
从您所描述的行为来看,您实际上正在寻找 32 位应用程序。在这种情况下,无论 Windows 是 32 位还是 64 位,您都可以使用相同的代码;你原来的问题想得太多了。
这是您更新的问题的更正代码:
[Code]
function InitializeSetup: Boolean;
begin
// allow the setup to continue initially
Result := True;
if not RegKeyExists(HKLM, 'SOFTWARE\ABC\Option\Settings') then
begin
// return False to prevent installation to continue
Result := False;
// and display a message box
MsgBox('please install ABC first!!', mbError, MB_OK);
end;
end;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6756 次 |
| 最近记录: |