Put an application in foreground

  • Thread starter Thread starter Andrea Caldarone
  • Start date 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?
 
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
 
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
 
Back
Top