Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: How to change to another open Application



Permlink Replies: 1 - Last Post: Mar 27, 2018 9:40 AM Last Post By: Remy Lebeau (Te...
Carlos Matos

Posts: 114
Registered: 6/25/01
How to change to another open Application
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 27, 2018 8:49 AM
I need, from within an application, to change to another running application, bring it to front, so that second application becomes the active application.
I already know how to get the application ID process but I can change to that second application.

How can I do this?
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: How to change to another open Application
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 27, 2018 9:40 AM   in response to: Carlos Matos in response to: Carlos Matos
Carlos Matos wrote:

I need, from within an application, to change to another running
application, bring it to front, so that second application becomes
the active application. I already know how to get the application ID
process but I can change to that second application.

You will have to enumerate running windows until you find the one(s)
that belog to that same process ID, then use SetForegroundWindow() to
bring one of them to the foreground. But, be aware that
SetForegroundWindow() has many restrictions on who is allowed to bring
a window to the foreground. And also that if the target app has
multiple windows, it might be difficult to deduce which window is the
right one to bring to the foreground.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02