Put an application in foreground

  • Thread starter Andrea Caldarone
  • Start date
A

Andrea Caldarone

Hi all,

I have 2 applications, let's call them App-1 and App-2. I have to have a
button on App-1 that when pressed:

if App-2 is not running, starts it (this is easy to do)
if App-2 is running places it in the foreground (and pass the focus to it)

any idea?
 
O

Onur Güzel

Hi all,

I have 2 applications, let's call them App-1 and App-2. I have to have a
button on App-1 that when pressed:

if App-2 is not running, starts it (this is easy to do)
if App-2 is running places it in the foreground (and pass the focus to it)

any idea?

Hi,
As you're asking 2nd question, after checking whether its running (by
querying using getprocesses method in process class), you can activate
(meaning focus) application using AppActivate function by passing
process ID or title string:
http://msdn.microsoft.com/en-us/library/dyz95fhy(VS.80).aspx

For example to Activate an application whose title is "App-2", just
use:
AppActivate("App-2")

Hope this helps,

Onur Güzel
 
A

Andrea Caldarone

thank you

"Onur Güzel" <[email protected]> ha scritto nel messaggio
Hi all,

I have 2 applications, let's call them App-1 and App-2. I have to have a
button on App-1 that when pressed:

if App-2 is not running, starts it (this is easy to do)
if App-2 is running places it in the foreground (and pass the focus to it)

any idea?

Hi,
As you're asking 2nd question, after checking whether its running (by
querying using getprocesses method in process class), you can activate
(meaning focus) application using AppActivate function by passing
process ID or title string:
http://msdn.microsoft.com/en-us/library/dyz95fhy(VS.80).aspx

For example to Activate an application whose title is "App-2", just
use:
AppActivate("App-2")

Hope this helps,

Onur Güzel
 

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