Inno setup Inno Setup,在文件夹选择步骤中显示msgbox

Inno setup Inno Setup,在文件夹选择步骤中显示msgbox,inno-setup,Inno Setup,我试图仅在用户到达文件夹选择页面时显示消息框,以下是在设置开始时显示消息框的实际代码: [code] var ApplicationPath: string; function GetAppPath(Param: String): String; begin RegQueryStringValue(HKLM, 'SOFTWARE\XXX\XXX', 'Install Dir', ApplicationPath) if ApplicationPath = '' then begin

我试图仅在用户到达文件夹选择页面时显示消息框,以下是在设置开始时显示消息框的实际代码:

[code]
var ApplicationPath: string;

function GetAppPath(Param: String): String;
begin
RegQueryStringValue(HKLM, 'SOFTWARE\XXX\XXX', 'Install Dir', ApplicationPath)
  if ApplicationPath = '' then
    begin
    MsgBox('Install folder non found', mbError, MB_OK);
    result:=ApplicationPath;
    end
    else
    MsgBox('Install folder found in "' + ApplicationPath + '". NOTE: close the program before proceeding.', mbInformation, MB_OK);
    result:=ApplicationPath;
    end;
end.
我需要像这样的东西:

如果PageId=wpSelectDir,则。。。 [运行上述代码]


但我真的不知道该怎么办,谢谢你的帮助。

最理想的活动是。当显示“选择目录”页面时,可以通过这种方式运行代码:

[Code]
procedure CurPageChanged(CurPageID: Integer);
var
  AppPath: string;
begin
  if (CurPageID = wpSelectDir) then
  begin
    // this will query the string value in registry; if that succeed and the
    // value is read, then the message box about success is shown, otherwise
    // the error message box about failure is shown
    if RegQueryStringValue(HKLM, 'SOFTWARE\XXX\XXX', 'Install Dir', AppPath) then
      MsgBox('Installation folder found...', mbInformation, MB_OK)
    else
      MsgBox('Installation folder not found...', mbError, MB_OK);
  end;
end;

请记住,此事件在第一次访问页面时以及在返回页面时都会运行。这包括如果用户下一步经过页面,然后返回到页面,当返回页面时,他们不希望覆盖之前的选择。因此,通常最好从上一页的下一个按钮单击来执行任何自动填充任务。@Miral,说得对!对于这种情况,“下一步”按钮事件可能更便于用户使用。感谢您的帮助,但如果我将代码如下所示:[code]var ApplicationPath:string;过程CurPageChangedCurPageID:Integer;如果CurPageID=wpSelectDir,则开始//这里是上面的代码函数GetAppPathParam:String:String;等等等等结束,;终止它给了我一个错误,它不正确。您只需要将GetAppPath函数的代码移到那里。不是整个函数及其标题。但是现在再看看GetAppPath函数,它的真正用途是什么?如果您要查找以前安装应用程序的目录,并且希望在继续之前告诉用户关闭此应用程序,则所有这些都已内置在InnoSetup中。是的,我知道inno setup会自动搜索适当的文件夹,但这是一个附加程序,其安装程序不是用inno安装程序构建的。无论如何,我试过了,但是如果我把代码移到你建议的过程中,我总是会出错,你能修改你的答案并告诉我如何正确地编写它吗?非常感谢