Advertisement
diofa

Komang Add ProgBar

Nov 26th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.16 KB | None | 0 0
  1. txtConsoleOut.Clear()
  2.         psi = New ProcessStartInfo("Data\adbrecovery.bat")
  3.  
  4.         Dim systemencoding As System.Text.Encoding = _
  5.             System.Text.Encoding.GetEncoding(Globalization.CultureInfo.CurrentUICulture.TextInfo.OEMCodePage)
  6.         With psi
  7.             .UseShellExecute = False  ' Required for redirection
  8.             .RedirectStandardError = True
  9.             .RedirectStandardOutput = True
  10.             .RedirectStandardInput = True
  11.             .CreateNoWindow = True
  12.             .StandardOutputEncoding = systemencoding  ' Use OEM encoding for console applications
  13.             .StandardErrorEncoding = systemencoding
  14.         End With
  15.         ' EnableraisingEvents is required for Exited event
  16.         cmd = New Process With {.StartInfo = psi, .EnableRaisingEvents = False}
  17.         AddHandler cmd.ErrorDataReceived, AddressOf Async_Data_Received
  18.         AddHandler cmd.OutputDataReceived, AddressOf Async_Data_Received
  19.         AddHandler cmd.Exited, AddressOf CMD_Exited
  20.  
  21.         cmd.Start()
  22.  
  23.         ' Start async reading of the redirected streams
  24.         ' Without these calls the events won't fire
  25.         cmd.BeginOutputReadLine()
  26.         cmd.BeginErrorReadLine()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement