【发布时间】:2013-10-10 13:05:46
【问题描述】:
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}'; 不起作用
【问题讨论】:
-
ExpandConstant('{app}') + '\{#Exewampmanager}'- 在脚本中DefaultDirName变为{app}常量。你可以像上面那样使用它。 -
现在这个应该可以了
-
ExecInfo.lpFile := ExpandConstant('{app}') + '\{#Exewampmanager};应该可以正常工作。 -
OT:如果它直到那个时候才终止,你将在 3 秒后杀死那个 wamp。你知道的,对吧?
-
请不要用“Windows 安装程序”标记 inno-setup 问题。这两种技术无关。
标签: inno-setup