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
Solved

WaitForSingleObject and DOS-Windows in Win98

Posted on 2002-05-10
2
272 Views
Last Modified: 2012-06-27
I'm trying to start a DOS-Application under Win98
from Delphi with CreateProcess.
Further on I want to wait for the end of the
execution, using WaitForSingleObject.

The problem is, that DOS-applications as default
do not automatically close the DOS-window when
finished. So I have to close the window manually,
to make WaitForSingleObject detect the end of
the execution.

I used sw_hide - option to prevent from displaying
the DOS-window, but this does not help.

For normal applications the property can be set manally
with applications file|properties ..close.. (don't know the exact name in the english version...).

Can I simply change the default options for DOS-windows,
or can I use CreateProcess with special options to
close after execution end??


Thanks for help,

Gamba

0
Comment
Question by:Gamba
2 Comments
 
LVL 1

Accepted Solution

by:
gd2000 earned 100 total points
ID: 7000746
When you initiate the DOS program prefix it with the following:

command.com /c <nameofprog>

This means that once the DOS program has finished executing it will close automatically (e.g. type "command.com /c dir" into the run command at the start button. WaitForSingleObject will pick up on the close then.
0
 

Author Comment

by:Gamba
ID: 7000805
Great, this works!!!

Thank you,

Gamba

0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

838 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