Solved

Closing MSDOS windows in Delphi

Posted on 2000-04-08
3
307 Views
Last Modified: 2010-04-04
Hello,
I have written a DOS batch file that runs from my delphi program using the
shell execute statement.Note the application runs hidden since I used the
SW_HIDE command.
Problem: how do I close the MSDOS box or
application when I exit my delphi application. In my batch file I use the
'exit' command which terminates the batch file okay but not the msdos box
where the batch ran from.I found this
out when I shut down windows that the
MSDOS windowed box was still open but
note the batch file had terminated.
Regards,
Frank
0
Comment
Question by:frw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 17

Expert Comment

by:inthe
ID: 2697095
Hi,
you can use:

WinExec('command.com /c Some.bat',SW_HIDDEN);
 
calling command.com with the /c closes the dos window when finshed.
 
you can also use command.com /c with shellexecute but it saves adding the whole shellapi unit to your uses by just using winexec() ..

Regards Barry
0
 
LVL 17

Accepted Solution

by:
inthe earned 100 total points
ID: 2697135
yep ive just tested and works fine..
0
 

Expert Comment

by:MWilson
ID: 2697170
The easiest, non-code way to get the DOS window to close is to use the Windows Explorer to locate the batch file name, right click it to show the Properties, and then check the "Close on Exit" option.

This will work for Windows 95, 98, NT 4.0, and 2000.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Correct Component for Shopping Cart. 2 121
DBCtrlGrid, Delphi, Scroll 8 60
delphi popmenu non latine charcters 3 35
migrate this code to work on android 1 34
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question