I am developing a windows service, in VB.NET, that launches a legacy application that performs some work. The service acts as a wrapper around the legacy app allowing users to automate an otherwise manual operation.

Everything is working great, except occasionally the legacy app displays a messagebox. When it does this the process halts until the message box is closed.

As the service will be running on a server there will be no user to close the message box.

The service launches the legacy application in a `System.Diagnostics.Process`.

Is there way to detect that a message box has been displayed by a process that I have started using `System.Diagnostics.Process`? And is there a way to close the messagebox through code?