Solved

Stopping parent process until child has completed?

Posted on 1998-11-12
8
200 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
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
Industry Leaders: 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!

 
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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
canBalance challenge 34 104
How to convert MFC::CString to UTF8 wchar_t* 10 369
wordmultiple challenge 12 154
Can not remove SSL certificate on iPhone 6 - iOS10.2 12 1,268
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

713 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