?
Solved

Stopping parent process until child has completed?

Posted on 1998-11-12
8
Medium Priority
?
205 Views
Last Modified: 2013-11-20
Iam using Winexec API to execute a dos exe for formatting disk  and when i call this function that dos exe is running in a separate process(child) and parent is going to execute next stmt. but only when that child process(i.e formatting) has completed then only parent should go to next stmt. execution how to know whether child has completed execution so that i can go to next stmt.? I have seen Spawn and exec functions to run dos exe but they are not supported in Win3.11 Please help me? I want in Windows(16bit).
0
Comment
Question by:gspk
[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
8 Comments
 

Author Comment

by:gspk
ID: 1324565
please help me
0
 
LVL 1

Expert Comment

by:hilit
ID: 1324566
Can you use CreateProcess instead? If your application is win95/NT try it and then you will be able to get the process information.
Then you should use _cwait which is the function that waits until a proces is over.
Good luck
Hilit
0
 
LVL 12

Expert Comment

by:migel
ID: 1324567
Hi!
You can use IsTask() function inside message pump to determine is task runnig.
for example:
hDosTask = WinExec("Program to run", SW_SHOW);
if (hDosTask > 32)
{
while (TRUE)
{
if (IsTask(hDosTask))
    {
    MSG msg;
    while (PeekMessage(hWnd, &msg, NULL, NULL, PM_REMOVE))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }
else
    break;
}
// continue work...
}

0
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 
LVL 3

Expert Comment

by:shaig
ID: 1324568
The function is called:      system()
0
 

Author Comment

by:gspk
ID: 1324569
no sense.......it makes
0
 
LVL 3

Accepted Solution

by:
shaig earned 100 total points
ID: 1324570
Yes it does (atleast to some of us).

the ::system() function documentation says:
The system function passes command to the command interpreter, which executes the string as an operating-system command.
please type         system          in your visual editor, then select the word and finally press F1 for more detailed information.
0
 
LVL 3

Expert Comment

by:shaig
ID: 1324571
If this is not enough, here is some more information from the documantatin, that is self-explanetory:

/* SYSTEM.C: This program uses
 * system to TYPE its source file.
 */

#include <process.h>
void main( void )
{
   system( "type system.c" );
}
0
 

Author Comment

by:gspk
ID: 1324572
See iam using it in windows if you call system it goes in to dos mode for execution ok but the function returns immediately and goes to next stmt execution in windows and the dos exe runs in the background in a separate thread we can't know whether it is completed or not i want it at any cost. In we can't use functions like spawn or execv to check whether that task is ruunning or not as thay ar not supported in win3.11 and i want in win3.11
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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Suggested Courses

718 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