[Run] Filename: "{app}\MeuPrograma.exe"; Description: "Iniciar Meu Programa"; Flags: nowait postinstall skipifsilent; Check: ExecutarMeuPrograma; [Code] function IsAppRunning(const AFileName : string): Boolean; var SWbemLocator: Variant; SWbemService: Variant; SWbemObjectSet: Variant; begin try SWbemLocator := CreateOleObject('WBEMScripting.SWBEMLocator'); SWbemService := SWbemLocator.ConnectServer('', 'root\CIMV2', '', ''); SWbemObjectSet := SWbemService.ExecQuery('SELECT Name FROM Win32_Process WHERE Name="' + AFileName + '"'); Result := (SWbemObjectSet.Count > 0); finally SWbemLocator := Unassigned; SWbemService := Unassigned; SWbemObjectSet := Unassigned; end; end; function ExecutarMeuPrograma: Boolean; begin Result := not IsAppRunning('MeuPrograma.exe'); end;
O conteúdo desta página pode ajudar alguém? Compartilhe!