Solved

Stopping parent process until child has completed?

Posted on 1998-11-12
8
203 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
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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…
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.
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 …

626 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