Inno Setup:显示消息以通知用户在安装前关闭特定应用程序

Inno Setup: Show message to notify user to close specific application before install

我需要显示消息页面或按钮的代码来通知用户"Save your Drawings Autocad will close automatically"

我发现在按下“安装”按钮后强制关闭 AutoCAD 的代码。

 [Code]
  var ResultCode: integer;
  function PrepareToInstall(var NeedsRestart: Boolean): String;
  begin
    if (msgbox('Please Save your Drawings and close Autocad', mbConfirmation, MB_Ok) = IDOk) then
    function InitializeSetup(): Boolean;
    var ErrorCode: Integer;
    begin
    ShellExec('open',
    'taskkill.exe',
    '/f /im acad.exe','',SW_HIDE,ewNoWait,ErrorCode);
    ShellExec('open',
    'tskill.exe',
    ' ACAD','',SW_HIDE,ewNoWait,ErrorCode);
    result := True;
    end;
        end;

代码应该是这样的:

[Code]

function InitializeSetup(): Boolean;
var
  ErrorCode: Integer;
begin
  if MsgBox('Save your Drawings and close Autocad', mbConfirmation, MB_OK) = IDOK then
  begin
    ShellExec('open', 'taskkill.exe', '/f /im acad.exe','', SW_HIDE, ewNoWait, ErrorCode);
    ShellExec('open', 'tskill.exe', ' ACAD', '', SW_HIDE, ewNoWait, ErrorCode);
    Result := True;
  end
    else
  begin
    Result := False;
  end;
end;