Solved

Closing MSDOS windows in Delphi

Posted on 2000-04-08
3
304 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
  • 2
3 Comments
 
LVL 17

Expert Comment

by:inthe
Comment Utility
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
Comment Utility
yep ive just tested and works fine..
0
 

Expert Comment

by:MWilson
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

728 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now