Board index » delphi » Executing a dos prog in Win 95 and forcing the dos prompt to close after

Executing a dos prog in Win 95 and forcing the dos prompt to close after

Hello All....

In windows 95 when executing a dos program, an ms-dos prompt window
is opened and the program is executed. If the program writes
to the screen the dos-prompt is not closed automatically because
the program produced an output to screen.

My problem is that from a windows program I am writing in Delphi 2,
I launch a DOS program (with CreateProcess) that produces
some screen output.
When the DOS program ends the window is not closed.
How from my windows program with Delphi 2 can I force the dos
window to close ??

Thanks for any help ...

Regards Serge

 

Re:Executing a dos prog in Win 95 and forcing the dos prompt to close after


On Thu, 12 Dec 1996 01:10:06 +0100, Serge Sozonoff

Quote
<ser...@dataform.com> wrote:
>In windows 95 when executing a dos program, an ms-dos prompt window
>is opened and the program is executed. If the program writes
>to the screen the dos-prompt is not closed automatically because
>the program produced an output to screen.

>When the DOS program ends the window is not closed.
>How from my windows program with Delphi 2 can I force the dos
>window to close ??

a) Set the properties for the given DOS exe properly; AFAIK you cannot
do this programmatically

b) an alternative was suggested by Meik Weber:

Quote
>Try to add a "|exit" (pipe-exit) to your command string. That
>worked with WinExec and closed the DOS-Box regardless of PIF-Settings.
>I don't know if this _always_ works or works on NT. But I know this
>technique is used in a well known setup-program.

This did NOT work for me with some software.
--
Stefan Hoffmeister                   Stefan.Hoffmeis...@Uni-Passau.de
University of Passau, Bavaria, Germany

Re:Executing a dos prog in Win 95 and forcing the dos prompt to close after


On Thu, 12 Dec 1996 01:10:06 +0100, Serge Sozonoff

Quote
<ser...@dataform.com> wrote:
>Hello All....

>In windows 95 when executing a dos program, an ms-dos prompt window
>is opened and the program is executed. If the program writes
>to the screen the dos-prompt is not closed automatically because
>the program produced an output to screen.

>My problem is that from a windows program I am writing in Delphi 2,
>I launch a DOS program (with CreateProcess) that produces
>some screen output.
>When the DOS program ends the window is not closed.
>How from my windows program with Delphi 2 can I force the dos
>window to close ??

>Thanks for any help ...

Hi, I once solved this problem for someone else (not mentioned here).
The circumstances were a bit different, but maybe this works with
CreateProcess, too.

Solution 1)
Fiddle around with these .PIF settings and make sure the "close
window" check box is checked.

Solution 2)
The API-Call
WinExec ('ANYEXE.EXE|exit');
closes the ANYEXE.EXE right after it finishes, regardless of the
PIF-settings.
This was tested to work find with Win95.
The trick is to add this pipe-exit to the command line.
try it, maybe it works.

Hope this helps
  Meikel Weber
make sure you visit my homepage
http://ourworld.compuserve.com/Homepages/meikel/mew.htm
When replying via E-Mail, strip the "*" in front of my address

Other Threads