By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,908 Members | 2,056 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,908 IT Pros & Developers. It's quick & easy.

Windows order problem when starting an external process

P: n/a
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?

Oct 17 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Oct 17, 10:03 am, ropo <ARop...@yahoo.co.ukwrote:
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().
Oct 18 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.