1

I have the following click event method and I am trying to use the {pf} constant within this method.

How can the constant be used?

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 Answer 1

1

You must first expand the constant value e.g. by using ExpandConstant function:

SomeFunctionWithFileParameter(ExpandConstant('{pf}\wampmanager.exe'));
2
  • ok, this works; now, how do i get the url where the app has been installed? Oct 11, 2013 at 7:37
  • Uhm, URL ? I think you mean just path, where the user chose to install the application. If so, then what the user enters in the Select Destination Location page can be expanded from the {app} constant.
    – TLama
    Oct 11, 2013 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.