1

我有以下点击事件方法,我正在尝试{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;
4

1 回答 1

1

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

SomeFunctionWithFileParameter(ExpandConstant('{pf}\wampmanager.exe'));
于 2013-10-11T07:18:16.043 回答