Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launching external applications through the RUN command 1

Status
Not open for further replies.

davidtoranzo

Programmer
May 23, 2001
76
0
0
GB
Hi,

I'm really at a loss with the following problem. I start an extenal application (e.g. Excel) from within a program, but it doesn't activate at the front, but behind my foxpro application.

If I start it from the command window, the external applicatin appears frontmost.

The code:
comm='RUN /N3 ' + m.excel + ' /r ' + m.file+'.xls'
&comm

(m.excel stores the fullpath for excel.exe. If matters, I'm working with FPW 2.6a and MSOffice '97)

Thanks and excuse my English
 
There is an error in your command line
comm='RUN /N3 ' + m.excel + ' /r ' + m.file+'.xls'
should be
comm='RUN /3 ' + m.excel + ' /r ' + m.file+'.xls'
try that and let us know the results David W. Grewe
Dave@internationalbid.com
ICQ VFP ActiveList #46145644
 
Thanks, Dave, it worked OK!

It seems there has been an error of interpretation of the spanish documentation, that express the "N" shouldn't be ommited.

I'm a new one to this forum and, slightly selfishly, I'm glad to see many programmers had to pass through similar extrange behaviours of my anyway loved foxpro!

Till next.
 
Your Very Welcome. David W. Grewe
Dave@internationalbid.com
ICQ VFP ActiveList #46145644
 
Actually I think there's a misprint in the English documentation too. So you're not the only one to have this problem ;-)
 
This seems no to be finished!

I have some common procedures collected in a file ("tools.prg"). Every project I create, in its main procedure, has a command line as follows:

SET PROCEDURE TO [path]\tools.prg ADDITIVE

One of these shared procedures is called "OpenExcel", where part of its code I posted first:

m.comm='RUN /N3 ' + m.excel + ' /r ' + m.file + '.xls'
&comm

The strange thing is in some compiled applications, Excel remains behind the FoxPro ones and in others, frontmost. I don't understand, it's the same routine that launches it!

Trying dgrewe recomendation, as I said, works ok. But it invokes foxpro.pif and in slow machines you see the opening and closing of DOS windows. This is not a real problem, it's just a matter of understanding why things happen!

Note: I couldn't ever do this through DDE either!
:-I
 
RUN command is a DOS command. So the DOS window opens and then the RUN command.. sends the code following the RUN to the DOS prompt as if it was keyed in. That command activates what you wanted and so the window gets closed automaticaly... This is what is happening when the RUN command is issued.

Regarding why the window is foremost or not.. depends on the initiation of the process and the activation. I have no answer with limited materials in here.. ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
A translation of my documentation says:

"A Windows based aplication executed with the RUN /N command will behave in the same way as if it would be opened through the Program Manager or the File Manager".

So I agree Ramani if the "/N" parameter is not included. If it is, the behavior of the command is "windows-like".

Regarding to Ramani's comment "...depends on the initiation of the process and the activation...", as its showed before I included the /N3 parameter, where the 3 should mean "Activated and Maximized"

:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top