2

I am starting a new process using the following code:

    Dim procStartInfo As New ProcessStartInfo
    Dim procExecuting As New Process

    With procStartInfo
        .FileName = "C:\PTL\Bin\xxxxxx.exe"
        .WindowStyle = ProcessWindowStyle.Normal
        .Arguments = "/POLL:5"
    End With

    procExecuting = Process.Start(procStartInfo)

But when this is called the application I am calling it from loses focus (even if the window style is set to Hidden), so if I am typing in a text box on the form key presses are effectively lost because they are redirected to the new app.

Is there some way that I can start a process and keep the focus?

Matt Wilko
  • 26,994
  • 10
  • 93
  • 143

2 Answers2

0

you need to call windows API to hide the window created from the process. check: http://social.msdn.microsoft.com/Forums/eu/vbgeneral/thread/7dace225-e4d0-4b0e-b61b-fceb7a5a4860

urlreader
  • 6,319
  • 7
  • 57
  • 91
0

if you want to send keys into the textbox, use sendmessage.

http://www.pinvoke.net/default.aspx/user32.sendmessage

famf
  • 2,225
  • 19
  • 17