以下の内容はhttps://blog.systemjp.net/entry/2020/10/05/230049より取得しました。


inno setupで指定exeが起動してたら中断する

[Code]
function IsAppRunning(const FileName : string): Boolean;
var
  FSWbemLocator: Variant;
  FWMIService : Variant;
  FWbemObjectSet: Variant;
begin
  Result := false;
  FSWbemLocator := CreateOleObject('WBEMScripting.SWBEMLocator');
  FWMIService := FSWbemLocator.ConnectServer('', 'root\CIMV2', '', '');
  FWbemObjectSet := FWMIService.ExecQuery(Format('SELECT Name FROM Win32_Process Where Name="%s"',[FileName]));
  Result := (FWbemObjectSet.Count > 0);
  FWbemObjectSet := Unassigned;
  FWMIService := Unassigned;
  FSWbemLocator := Unassigned;
end;

function InitializeSetup: boolean;
begin
Result := not IsAppRunning('excel.exe');
if not Result then
MsgBox('Excelが起動しています。Excelを終了させてから再度インストールをお試し下さい。', mbError, MB_OK);
end;



以上の内容はhttps://blog.systemjp.net/entry/2020/10/05/230049より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14