3

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

[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.

我需要类似的东西:

If (PageId = wpSelectDir) then... [运行上面的代码]

但我真的不知道如何,谢谢你的帮助。

4

1 回答 1

2

理想的活动是CurPageChanged. 当显示选择目录页面时,您可以使用这种方式运行代码:

[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;
于 2013-02-21T16:49:31.237 回答