Inno Setup Compiler:如何在事件方法中使用常量?

时间:2013-10-11 07:03:49

标签: inno-setup

我有以下点击事件方法,我试图在此方法中使用{pf}常量。

如何使用常量?

function NextButtonClick(CurPageID: Integer): Boolean;
var
  ErrorCode: Integer;
begin
  // always allow move through the wizard pages
  Result := True;
  // if we are on the final page, run list is visible and the first item
  // in the run list (our fake check box) is checked, then...
  if (CurPageID = wpFinished) and (WizardForm.RunList.Visible) and
    (WizardForm.RunList.Checked[0]) then
  begin
    // execute application you need here (I like calc.exe :) and wait for
    // its termination for a specified time (here 5000 ms); if the calc.exe
    // will be closed in 5 seconds, a default browser will navigate to the
    // Google page, otherwise the setup just quit (keeping calc.exe running)
    if ShellExecWait('', {pf}'\wampmanager.exe', '', '', SW_SHOWNORMAL, 5000) then
      ShellExec('', 'http://localhost/cow', '', '', SW_SHOW, ewNoWait, ErrorCode);
  end;
end;

1 个答案:

答案 0 :(得分:1)

您必须先扩展常量值,例如使用ExpandConstant函数:

SomeFunctionWithFileParameter(ExpandConstant('{pf}\wampmanager.exe'));