Solved

How to close dos-window after shellexecute?

Posted on 1997-04-16
3
447 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

759 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

17 Experts available now in Live!

Get 1:1 Help Now