Windows order problem when starting an external process

  • Thread starter Thread starter ropo
  • Start date Start date
R

ropo

I have a .NET 2.0 app that at one point starts an old MFC App through
System.Diagnostics.Process.Start from a model form/

I then wait for it to finish by calling StartedProcess.WaitForExit();

Problem is:

When I close the MFC app if there is an window behind my .NET app it
will come to the front leaving my .NET app at the back.

I've tried calling BringToFront before starting the MFC and after it
has finished but to no avail.

Note: if there is no other windows behind my application it is ok.


Anyone think of anything to try?
 
I have a .NET 2.0 app that at one point starts an old MFC App through
System.Diagnostics.Process.Start from a model form/

I then wait for it to finish by calling StartedProcess.WaitForExit();

Problem is:

When I close the MFC app if there is an window behind my .NET app it
will come to the front leaving my .NET app at the back.

I've tried calling BringToFront before starting the MFC and after it
has finished but to no avail.

Note: if there is no other windows behind my application it is ok.

Anyone think of anything to try?

I found the problem: My window that created the process set
"this.Enabled = false;" before starting the process, when a window is
disabled it in no longer available to windows (alt-Tab and its not
there). So after the process closes it returns to the next availble
window. My solution was to have the window disabled, the enable it
after starting the process and before WaitForExit().
 
Back
Top