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

时间:2016-04-04 12:42:22

标签: inno-setup

我需要显示消息页面或按钮的代码以通知用户“保存图纸Autocad将自动关闭”

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

=findvalueandrange(searchstring,selectyourrange)

Public Function findvalueandrange(findingtext As String, r As Range) As String
    Dim cell As Range
    For Each cell In r.Cells
        If LCase(cell.Value) = LCase(findingtext) Then
            If findvalueandrange = "" Then
                findvalueandrange = cell.Address & ":" & cell.Value
            Else
                findvalueandrange = findvalueandrange & "|" & cell.Address & ":" & cell.Value
            End If
        End If
    Next cell
End Function

1 个答案:

答案 0 :(得分:0)

代码应该是:

[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;