Results 1 to 3 of 3

Thread: [2005] RedirectStandardOutput + hiding Window

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2006
    Location
    City of Angles. Right Angles.
    Posts
    110

    [2005] RedirectStandardOutput + hiding Window

    I am trying to use the Process class to launch a program, and it is working fine, except I cannot hide the window. I'm guessing it's because it's a command line program, but I don't like a blank black cmd window popping up for a second while the external program is doing its work. I am using the following code:
    VB Code:
    1. Process snmp = new Process()
    2.             ProcessStartInfo psi = new ProcessStartInfo()
    3.  
    4.             psi.FileName = "snmpwalk.exe"
    5.             psi.Arguments = txtQuery.Text
    6.             psi.UseShellExecute = false
    7.             psi.RedirectStandardOutput = true
    8.             psi.WindowStyle = ProcessWindowStyle.Hidden
    9.             snmp.StartInfo = psi
    10.             snmp.Start()
    11.             this.BringToFront() 'thought this would bring my app in front of the window, but nope!
    12.             snmp.WaitForExit(500)
    13.             txtResult.Text = txtResult.Text + snmp.StandardOutput.ReadToEnd()

    Anyone have any ideas about how I can hide the window?

  2. #2
    Hyperactive Member ZaNi's Avatar
    Join Date
    Jun 2006
    Location
    Australia
    Posts
    360

    Re: [2005] RedirectStandardOutput + hiding Window

    VB Code:
    1. psi.CreateNoWindow = True

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2006
    Location
    City of Angles. Right Angles.
    Posts
    110

    Re: [2005] RedirectStandardOutput + hiding Window

    Awesome, I will test that out tomorrow when I'm working on the project again. Thanks ZaNi.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width