Posted by jon barlow on May 25, 2001
i need to run an exe file or application through delphi and i cant find the code
Re: webmaster Guido on May 24, 2001
Have a look in DelphiLand's Code Snips section. You'll find an article about
this, together with the Delphi source code for an example project ;-)
Re: Dave McNeill on June 13, 2001
Well it's taken me an hour of searching Delphi help and the internet
to find this little gem - how to run an external program from Delphi.
Those searching the net
might strike this point a little sooner:
external program
dos
shell
run command
start dos executable
program file
console
command line
run program
dos interpreter
DaveMc
Re:Re: Luke Philpot on July 05, 2001
I have also been looking for this - HOORAY!!!
Re: Re: Paul Merkx on January 11, 2002
Thanks Dave,
I was looking for that function too :-)
Re:ReRe: Dave McNeill on August 16, 2001
Have the project installed, works well.
I'm starting a BAT file, to do some stuff, which it does nicely, but the DOS window
won't close on exit. On any ordinary shortcut, I simply click the close window on
exit tick box on the program tab.
I've tried reading as much on ShellExecute in the WinSDK as I can understand, but
nothing. Tried setting cwe in command.com section of inf\apps.inf, nothing. Tried
the pif files dosprmpt and command in \windows, or properties of them, nope.
So, when you shellexecute, how do you convince windows to close the window on exit?
Re:Re: Dave McNeill on August 16, 2001
Ok, so I've found it, answered my own question.
This is arcane, but then this is Windows
Article Q152682
SUMMARY
In Windows 95, the default behavior of the operating system is to keep the console window
of an MS-DOS application open if it has displayed text in the window. This provides
users with an opportunity to read any messages that may have been displayed in the
window before the window is closed. To close a window in this state, you must click
the close button (that is, "X") on the window caption or Close on the System menu.
In some instances, however, the user's needs may require that the console window
close automatically. The solution is to programmatically remove all the displayed
text of an MS-DOS application thereby allowing the console window to close automatically.
MORE INFORMATION
The displayed text of an MS-DOS application can be removed by adding the application
to the following .bat file:
@echo off
@cls
Then launch this .bat file instead of the original application. The first line,
@echo off, prevents .bat file commands from being displayed in the window. Once the
MS-DOS application has completed, the cls command clears any text that may have been
sent to the Console window. Thus, because no displayed text has been left in the
Console window, the Console window closes after the .bat file has completed.
Could Guido add this snip to the readme for execwait?
David
DelphiLand FAQ |