Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to close dos-window after shellexecute?

Posted on 1997-04-16
3
Medium Priority
?
461 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 100 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

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 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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

609 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