Solved

Closing MSDOS windows in Delphi

Posted on 2000-04-08
3
306 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
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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
oracle global variables 4 68
select query - oracle 16 100
Delphi: ForceDirectory plain function 7 33
Graphics32 under Delphi 10.1 Berlin 2 67
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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