Solved

WaitForSingleObject and DOS-Windows in Win98

Posted on 2002-05-10
2
273 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

685 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