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:
Danke im voraus.
Marco
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
- Function Konvertieren(ByVal Param As String)
- Dim TMP As String = SpeicherOrdner & "\" & Dateiname
- Dim p As New Process()
- Try
- p.StartInfo.FileName = Application.StartupPath & "\ffmpeg.exe"
- p.StartInfo.Arguments = Param
- p.StartInfo.UseShellExecute = False
- p.StartInfo.RedirectStandardOutput = True
- p.StartInfo.CreateNoWindow = True
- Dim sOutput As String
- p.Start()
- sOutput = p.StandardOutput.ReadToEnd()
- p.WaitForExit()
- p.Close()
- Catch ex As Exception
- MessageBox.Show(ex.Message & vbCrLf & "Bitte ""ffmpeg.exe"" in den Programmordner kopieren!", "ffmpeg.exe wurde nicht gefunden!", MessageBoxButtons.OK, MessageBoxIcon.Error)
- End Try
- clear()
- Return Nothing
- End Function
Danke im voraus.
Marco