0

I want to run an external .exe inside VB.Net. I am using these two objects to run the external process:

Dim pInfo As New ProcessStartInfo()
Dim p As Process = Process.Start(pInfo)

The .exe contains popups (MsgBox functions). My questions are:

  1. Is it possible to suppress these popups?
  2. How can I capture the return value from .exe? The .exe returns 0 or 1.
GSerg
  • 76,472
  • 17
  • 159
  • 346
sydney
  • 131
  • 8
  • 19
  • 2
    Suppressing popups isn't easy, but try looking at [this SO question](https://stackoverflow.com/questions/12532812/how-to-suppress-a-dialog-box-displayed-by-code-that-i-cant-change). As far as capturing the return value, it should just be `p.ExitCode`. You might need to call `p.WaitForExit()` first. – Icemanind Mar 14 '19 at 17:46
  • Q1: `yes` with a little work. Q2 : `yes its possible` – Trevor Mar 14 '19 at 17:47
  • OK. I will add p.WaitForExit() then follow by p.ExitCode and see if I can capture the return value. But I need help with Q1. Would you mind sharing some tips on this if you know how? Thanks – sydney Mar 14 '19 at 18:02
  • @sydney `Would you mind sharing some tips on this` that would require more than likely outside resources, such as tutorials etc... which is off topic here on SO. If you can show us your attempt and where you are stuck we would be glad to help you. – Trevor Mar 14 '19 at 19:27
  • See here: [How to get the text of a MessageBox when it has an icon?](https://stackoverflow.com/q/55014473/7444103). Two different methods (P/Invoking and UI Automation) to perform the same task. C# code. – Jimi Mar 14 '19 at 19:55
  • OK. I'm going to study the links you guys have posted and see if I could follow and get my code to work. Thanks much. – sydney Mar 15 '19 at 15:05

0 Answers0