Solved

How to close dos-window after shellexecute?

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

Technology Partners: 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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

690 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