Forcing application focus
Date: 05/28/06
(C Sharp) Keywords: programming, browser
I'm kind of new at the whole C#/Windows GUI programming thing, so sorry if this is a dumb question.
I'm working on a program and I want it to be able to launch links in an external browser. I found that you can use the Process class to do this, and if you even just hand the URL to the Process's "filename", it opens with whatever the user's default HTTP-handling application is. So I've got links launching in Firefox and everything, which is great. But I'd like it to send the link to be opened in Firefox without losing focus on my application.
I tried setting some of the Process.StartInfo members (like WindowStyle as minimized, even though that's not what I want) and then tried going about it the other way around, by just calling this.Activate() from the form that's calling the Process.Start() method, but that doesn't work either. Is there anything I can do to keep my application focused when launching a different process?
Source: http://community.livejournal.com/csharp/63983.html