Solved

How to close dos-window after shellexecute?

Posted on 1997-04-16
3
454 Views
Last Modified: 2010-04-04
If I do a shellexecute :

(You have to have shellapi in your uses clause,
in the tst.bat you can do something like dir /b,
handle is an integer)
 ShellExecute(handle,NIL,'tst.bat',NIL,'c:\tmp',SW_NORMAL);

I get a window which says "Finished tst.bat"
If I do:

ShellExecute(handle,NIL,'tst.bat',NIL,'c:\tmp',SW_HIDE);

I do not get that window, but it remains in memory.
(You can see this from the list of winoldap's in the process
list you get from doing ctrl-alt-del in win95)

The question is: How do I close that window?
0
Comment
Question by:jsirag
3 Comments
 
LVL 1

Accepted Solution

by:
sleach earned 50 total points
ID: 1335409
The answer is AMAZINGLY simple.

1) Find tst.bat in Windows Explorer.
2) Right click on tst.bat
3) From the popup menu, click Properties.
4) In the propertie sheet, click on the Program tab.
5) Check the box that says "Close on Exit."
6) click OK.

The window will now close automatically after it finishes its work.
Be sure to distribute the modified batch file with your app.
0
 
LVL 3

Expert Comment

by:mheacock
ID: 1335410
There's an API method to do this, which might be more suitable in the generic-code sense.
0
 

Author Comment

by:jsirag
ID: 1335411
Actually, the API method is what I was most interested in. Of
course, the answer works fine, but it is rather time-consuming
in a large company (to set all the dos-executable to auto-finish
for let's say several hunderd people). Furthermore I would like
to do the work in the program, not in windows.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

809 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