How to call function in procedure

1
function TForm1.VerificaExistenciaDoProcesso(NomeProcesso: String): Boolean;
var
  Continue: Boolean;
  FSnapshotHandle: THandle;
  FProcessEntry32: TProcessEntry32;
  begin
    Result := False;
    FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
    FProcessEntry32.dwSize := Sizeof(FProcessEntry32);
    Continue := Process32First(FSnapshotHandle,FProcessEntry32);
    while Integer(Continue) <> 0 do
    begin
      if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =
             UpperCase(NomeProcesso)) or
              (UpperCase(FProcessEntry32.szExeFile) =
                 UpperCase(NomeProcesso))) then
      begin
        Result := True;
        Exit;
      end;
      Continue := Process32Next(FSnapshotHandle,FProcessEntry32);
    end;
    CloseHandle(FSnapshotHandle);
end;






procedure TForm1.Button1Click(Sender: TObject);
begin
      VerificaExistenciaDoProcesso('calc.exe'):Boolean;
end;

end.
    
asked by anonymous 11.01.2018 / 11:32

1 answer

2

Just simply call the function as follows

VerificaExistenciaDoProcesso('calc.exe');
    
11.01.2018 / 12:00