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.
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.
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.
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.
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.
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.
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.
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.
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.
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.