Windows order problem when starting an external process

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?
 
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 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().
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top