Index
2011-12-02 16:37Kent Belan : RUN an EXE
2011-12-02 16:50Eurico Chagas Filho : Re: RUN an EXE
2011-12-05 10:56Kent Belan : RE: RUN an EXE
2011-12-05 11:12Dave Crozier : RE: RUN an EXE
2011-12-05 11:14Dave Crozier : RE: RUN an EXE
2011-12-05 11:18Tracy Pearson : RE: RUN an EXE
2011-12-05 11:20Tracy Pearson : RE: RUN an EXE
2011-12-05 11:26Christof Wollenhaupt : Re: RUN an EXE
2011-12-05 11:48Kent Belan : RE: RUN an EXE
2011-12-05 11:50Kent Belan : RE: RUN an EXE
Back to top
RUN an EXE

Author: Kent Belan

Posted: 2011-12-02 16:37:58   Link

Hello,

Hope you don't mind if I have another question for today.

I have an application that one of the menu options starts a new VFP9

application.

So in the click event, the code looks like:

RUN /N NEWAPP.EXE

This works fine except the new NEWAPP.EXE starts up behind the existing

application.

I tried to remove the /N from the run command, and it does work better, but

leaves a command window hanging ...

How can I get NEWAPP.EXE to open as the active application ?

Thanks,

Kent

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/1A812A28B4F743CE945A58E1B8A50504@LaptopW7

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Kent Belan
Back to top
Re: RUN an EXE

Author: Eurico Chagas Filho

Posted: 2011-12-02 16:50:28   Link

I use ShellExecute(), perhaps u should consider it...

HTH, E.

>________________________________

> From: Kent Belan <kbelan@mchsi.com>

>To: 'ProFox Email List' <profox@leafe.com>

>Sent: Friday, December 2, 2011 7:37 PM

>Subject: RUN an EXE

>

>Hello,

>

>Hope you don't mind if I have another question for today.

>

>I have an application that one of the menu options starts a new VFP9

>application.

>

>So in the click event, the code looks like:

>RUN /N NEWAPP.EXE

>

>This works fine except the new NEWAPP.EXE starts up behind the existing

>application.

>

>I tried to remove the /N from the run command, and it does work better, but

>leaves a command window hanging ...

>

>How can I get NEWAPP.EXE to open as the active application ?

>

>Thanks,

>Kent

>

>

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/1322862628.49955.YahooMailNeo@web160803.mail.bf1.yahoo.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Eurico Chagas Filho
Back to top
RE: RUN an EXE

Author: Kent Belan

Posted: 2011-12-05 10:56:23   Link

I tried ShellExecute, but I get the same result.

The new EXE starts behind the application.

Any way for the new EXE to force itself to be in focus ?

I used to use this code in the main forms Init method:

Declare integer SetForegroundWindow in User32.dll Integer

SetForegroundWindow(this.HWnd)

But this is not working, maybe because I am on W7/64 computer ?

Thanks,

Kent

-----Original Message-----

From: profox-bounces@leafe.com [mailto:profox-bounces@leafe.com] On Behalf

Of Eurico Chagas Filho

Sent: Friday, December 02, 2011 4:50 PM

To: ProFox Email List

Subject: Re: RUN an EXE

I use ShellExecute(), perhaps u should consider it...

HTH, E.

>________________________________

> From: Kent Belan <kbelan@mchsi.com>

>To: 'ProFox Email List' <profox@leafe.com>

>Sent: Friday, December 2, 2011 7:37 PM

>Subject: RUN an EXE

>

>Hello,

>

>Hope you don't mind if I have another question for today.

>

>I have an application that one of the menu options starts a new VFP9

>application.

>

>So in the click event, the code looks like:

>RUN /N NEWAPP.EXE

>

>This works fine except the new NEWAPP.EXE starts up behind the existing

>application.

>

>I tried to remove the /N from the run command, and it does work better,

>but leaves a command window hanging ...

>

>How can I get NEWAPP.EXE to open as the active application ?

>

>Thanks,

>Kent

>

>

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/680A3129991F4B7BB37E76A0F248ED97@LaptopW7

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Kent Belan
Back to top
RE: RUN an EXE

Author: Dave Crozier

Posted: 2011-12-05 11:12:51   Link

Eurico,

Have you tried to run it using WSH:

#DEFINE EXEC_NOWAIT 0

#DEFINE EXEC_AND_WAIT 1

nWait_Mode= EXEC_AND_WAIT

cFile = <program name>

loShell = CreateObject ('WScript.Shell')

Try

loShell.Run (cFile, 1, nWait)

Endtry

Dave

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/BD031ECABF2B60499200AAB3DBB4A999921C17CB@EX-A-FPL.FPL.LOCAL

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Dave Crozier
Back to top
RE: RUN an EXE

Author: Dave Crozier

Posted: 2011-12-05 11:14:58   Link

Sorry that was aimed at Kent not Eurico.... ;-)

Dave

-----Original Message-----

From: profox-bounces@leafe.com [mailto:profox-bounces@leafe.com] On Behalf Of Kent Belan

Sent: 05 December 2011 15:56

To: 'ProFox Email List'

Subject: RE: RUN an EXE

I tried ShellExecute, but I get the same result.

The new EXE starts behind the application.

Any way for the new EXE to force itself to be in focus ?

I used to use this code in the main forms Init method:

Declare integer SetForegroundWindow in User32.dll Integer

SetForegroundWindow(this.HWnd)

But this is not working, maybe because I am on W7/64 computer ?

Thanks,

Kent

-----Original Message-----

From: profox-bounces@leafe.com [mailto:profox-bounces@leafe.com] On Behalf Of Eurico Chagas Filho

Sent: Friday, December 02, 2011 4:50 PM

To: ProFox Email List

Subject: Re: RUN an EXE

I use ShellExecute(), perhaps u should consider it...

HTH, E.

>________________________________

> From: Kent Belan <kbelan@mchsi.com>

>To: 'ProFox Email List' <profox@leafe.com>

>Sent: Friday, December 2, 2011 7:37 PM

>Subject: RUN an EXE

>

>Hello,

>

>Hope you don't mind if I have another question for today.

>

>I have an application that one of the menu options starts a new VFP9

>application.

>

>So in the click event, the code looks like:

>RUN /N NEWAPP.EXE

>

>This works fine except the new NEWAPP.EXE starts up behind the existing

>application.

>

>I tried to remove the /N from the run command, and it does work better,

>but leaves a command window hanging ...

>

>How can I get NEWAPP.EXE to open as the active application ?

>

>Thanks,

>Kent

>

>

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/BD031ECABF2B60499200AAB3DBB4A999921C17E8@EX-A-FPL.FPL.LOCAL

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Dave Crozier
Back to top
RE: RUN an EXE

Author: Tracy Pearson

Posted: 2011-12-05 11:18:16   Link

Kent Belan wrote on 2011-12-05:

> I tried ShellExecute, but I get the same result.

>

> The new EXE starts behind the application.

>

> Any way for the new EXE to force itself to be in focus ?

>

> I used to use this code in the main forms Init method:

>

> Declare integer SetForegroundWindow in User32.dll Integer

> SetForegroundWindow(this.HWnd)

>

> But this is not working, maybe because I am on W7/64 computer ?

>

> Thanks,

> Kent

>

Kent,

Is your EXE a Top-Level form with the CONFIG.FPW setting: Screen=off

Or is the _Screen visible?

Tracy Pearson

PowerChurch Software

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/001801ccb369$7edd44b0$7c97ce10$@powerchurch.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Tracy Pearson
Back to top
RE: RUN an EXE

Author: Tracy Pearson

Posted: 2011-12-05 11:20:01   Link

Dave Crozier wrote on 2011-12-05:

> Eurico,

> Have you tried to run it using WSH:

>

> #DEFINE EXEC_NOWAIT 0

> #DEFINE EXEC_AND_WAIT 1

>

> nWait_Mode= EXEC_AND_WAIT

> cFile = <program name>

>

> loShell = CreateObject ('WScript.Shell')

> Try

> loShell.Run (cFile, 1, nWait)

> Endtry

>

> Dave

>

Dave,

As long as the anti-virus isn't set in an aggressive posture, this works.

Tracy Pearson

PowerChurch Software

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/001901ccb369$bd8d16e0$38a744a0$@powerchurch.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Tracy Pearson
Back to top
Re: RUN an EXE

Author: Christof Wollenhaupt

Posted: 2011-12-05 11:26:35   Link

Windows moves the window into the foreground that the app first opens. If

you display a WAIT WINDOW or a splash screen before showing the main

window, your app might end up in the background.

Christof

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/CAL4QJhju_KM02vFhCbCwvjGkYuTdMREdwpbHhi8nZiBdiNP_Vw@mail.gmail.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Christof Wollenhaupt
Back to top
RE: RUN an EXE

Author: Kent Belan

Posted: 2011-12-05 11:48:37   Link

Hello Dave,

Just tried your code, thanks, but same result.

The new EXE starts up beind the current application.

Can't use the EXEC_AND_WAIT because the main program still needs to be

running.

Both wait options produce the same results with the new EXE starting up

behind.

Any other ideas ?

Thanks,

Kent

-----Original Message-----

From: profox-bounces@leafe.com [mailto:profox-bounces@leafe.com] On Behalf

Of Dave Crozier

Sent: Monday, December 05, 2011 11:13 AM

To: ProFox Email List

Subject: RE: RUN an EXE

Eurico,

Have you tried to run it using WSH:

#DEFINE EXEC_NOWAIT 0

#DEFINE EXEC_AND_WAIT 1

nWait_Mode= EXEC_AND_WAIT

cFile = <program name>

loShell = CreateObject ('WScript.Shell')

Try

loShell.Run (cFile, 1, nWait)

Endtry

Dave

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/C56AAFC6A4D044BCAB3E861424AEC874@LaptopW7

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Kent Belan
Back to top
RE: RUN an EXE

Author: Kent Belan

Posted: 2011-12-05 11:50:13   Link

Hello Tracy,

Yes, the new EXE is a VFP9 as top level form with screen=off

-----Original Message-----

From: profox-bounces@leafe.com [mailto:profox-bounces@leafe.com] On Behalf

Of Tracy Pearson

Sent: Monday, December 05, 2011 11:18 AM

To: profox@leafe.com

Subject: RE: RUN an EXE

Kent Belan wrote on 2011-12-05:

> I tried ShellExecute, but I get the same result.

>

> The new EXE starts behind the application.

>

> Any way for the new EXE to force itself to be in focus ?

>

> I used to use this code in the main forms Init method:

>

> Declare integer SetForegroundWindow in User32.dll Integer

> SetForegroundWindow(this.HWnd)

>

> But this is not working, maybe because I am on W7/64 computer ?

>

> Thanks,

> Kent

>

Kent,

Is your EXE a Top-Level form with the CONFIG.FPW setting: Screen=off

Or is the _Screen visible?

Tracy Pearson

PowerChurch Software

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/C7577E497D114447BA394D0EDF572E30@LaptopW7

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Kent Belan