0

I'd like my application to start another (3rd party) application, but without giving it focus. The 3rd party application is a GUI application, so it will create windows, etc - and that's fine, I want them - but my application should still stay in foreground until the user manually switches away from it.

(How) can I do that?

I'm using Windows 7, and I'm writing my app in VS2010, C# 4.0.

Vilx-
  • 104,512
  • 87
  • 279
  • 422

1 Answers1

0

After opening the 3rd party you can bring the current form back to the front.

private void OpenThirdParty
{
....

this.Show();
}

or however you can access the current form.

Antarr Byrd
  • 24,863
  • 33
  • 100
  • 188
  • I don't have control over the 3rd party app. Also, I know how to start it minimized - but I don't want that. I want the GUI windows to appear, just not get "foreground love" as it's called sometimes. – Vilx- Mar 12 '12 at 16:24
  • @try something like the change I made. – Antarr Byrd Mar 12 '12 at 16:33
  • I can try, but I think that it's a very unstable solution. Due to multithreading (and I've got 8 virtual CPU cores) there's no guarantee which application (mine or 3rd party) will get to call their `Show()` first. In fact it's most likely to be mine, because the other app still has to load all the required libraries, perform initialization, etc, while mine has this as the next instruction right after launching the other app. – Vilx- Mar 13 '12 at 08:20
  • Also I can't put this in a timer or on my focus lost event or anything. Windows doesn't allow arbitrary applications to steal focus as they please - you can only do that at certain points, like in response to user input or when starting up. – Vilx- Mar 13 '12 at 08:21