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

时间:2013-10-10 13:05:47

标签: inno-setup

inno setup compiler内有以下区域:

[Setup]
DefaultDirName={pf}\cow1


function NextButtonClick(CurPageID: Integer): Boolean;
var
  ExecInfo: TShellExecuteInfo;
begin
  Result := True;

  if CurPageID = wpFinished then
  begin
    ExecInfo.cbSize := SizeOf(ExecInfo);
    ExecInfo.fMask := SEE_MASK_NOCLOSEPROCESS;
    ExecInfo.Wnd := 0;
    ExecInfo.lpFile := DefaultDirName + '\{#Exewampmanager}';
    ExecInfo.nShow := SW_HIDE;

    if ShellExecuteEx(ExecInfo) then
    begin
      if WaitForSingleObject(ExecInfo.hProcess, 3000) = WAIT_TIMEOUT then
      begin
        TerminateProcess(ExecInfo.hProcess, 666);
        MsgBox('You just killed a little kitty!', mbError, MB_OK);
      end
      else
        MsgBox('The process was terminated in time!', mbInformation, MB_OK);
    end;
  end;
end;

如何在函数中使用[Setup]区域中的DefaultDirName const?

PS:

ExecInfo.lpFile := DefaultDirName + '\{#Exewampmanager}';不起作用

1 个答案:

答案 0 :(得分:0)

您必须展开常量,例如:

ExpandConstant('{app}\myapp.exe')

其中{app}是最终目标文件夹