System.Diagnostics.Process

OSVBNET 1,386 Reputation points
2022-05-20T18:47:49.397+00:00

Hello,
Need to have VC++ installed so I do check on Form_Load

Dim MyProcess As New System.Diagnostics.Process
MyProcess = New System.Diagnostics.Process()
MyProcess.StartInfo.FileName = blah
MyProcess.StartInfo.Arguments = "/quiet /norestart"
MyProcess.StartInfo.CreateNoWindow = True
MyProcess.StartInfo.UseShellExecute = False
MyProcess.StartInfo.RedirectStandardOutput = True
MyProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal / Hidden ?
MyProcess.Start()
MyProcess.WaitForExit()
If MyProcess.ExitCode <> 0 Then...
MyProcess.Close()

  1. Do I need to set: RedirectStandardOutput here?
  2. My problem is that it shows the MS VC++ installer evaluated window in the back of all windows, just blinking in the taskbar, can I force it show in the front?

Thanks.

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,570 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jiachen Li-MSFT 26,506 Reputation points Microsoft Vendor
    2022-05-26T06:56:34.417+00:00

    Hi @OSVBNET ,

    1. RedirectStandardOutput is not needed.
    2. It can be achieved by using the SetForegroundWindow function of win32 API.
      Best Regards.
      Jiachen Li

    ----------

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.