Status von einem "Process" anzeigen, damit das Programm nicht "hängt"

  • VB.NET

Es gibt 1 Antwort in diesem Thema. Der letzte Beitrag () ist von Alteran.

    Status von einem "Process" anzeigen, damit das Programm nicht "hängt"

    Hallo.
    Ich habe mal wieder ein Problem mit einer meiner Funktionen.
    Ich rufe in meinem Programm folgende Funktion auf, die eine Datei per ffmpeg.exe konvertiert.
    Jedoch muss mein Programm warten, bis ffmpeg fertig ist.
    Wie kann ich den Fortschritt ermitteln? Ohne, dass mein Programm den Anschein macht, dass es hängt.
    Hier mein Code:

    VB.NET-Quellcode

    1. Function Konvertieren(ByVal Param As String)
    2. Dim TMP As String = SpeicherOrdner & "\" & Dateiname
    3. Dim p As New Process()
    4. Try
    5. p.StartInfo.FileName = Application.StartupPath & "\ffmpeg.exe"
    6. p.StartInfo.Arguments = Param
    7. p.StartInfo.UseShellExecute = False
    8. p.StartInfo.RedirectStandardOutput = True
    9. p.StartInfo.CreateNoWindow = True
    10. Dim sOutput As String
    11. p.Start()
    12. sOutput = p.StandardOutput.ReadToEnd()
    13. p.WaitForExit()
    14. p.Close()
    15. Catch ex As Exception
    16. MessageBox.Show(ex.Message & vbCrLf & "Bitte ""ffmpeg.exe"" in den Programmordner kopieren!", "ffmpeg.exe wurde nicht gefunden!", MessageBoxButtons.OK, MessageBoxIcon.Error)
    17. End Try
    18. clear()
    19. Return Nothing
    20. End Function

    Danke im voraus.
    Marco