How to retreive the status of the child process?

Discussion in 'C++' started by yyii, Aug 31, 2003.

  1. yyii

    yyii Guest

    Hi,

    I have a problem on retreiving the status of the child process. I want to
    open IE and load local file. Just after it is loaded, I need to delete that
    local file. It seems that I can't use the function
    WaitForInputIdle/WaitForSingleObject in this situation. Please advise how I
    can be notified once the IE is completed reading the file. Many thanks!

    STARTUPINFO si;
    PROCESS_INFORMATION pi;

    ZeroMemory( &si, sizeof(si) );
    si.cb = sizeof(si);

    // Start the child process.
    if( !CreateProcess( strBrowser, // No module name (use command line).
    "random.html", // Command line.
    NULL, // Process handle not inheritable.
    NULL, // Thread handle not inheritable.
    FALSE, // Set handle inheritance to FALSE.
    0, // No creation flags.
    NULL, // Use parent's environment block.
    NULL, // Use parent's starting directory.
    &si, // Pointer to STARTUPINFO structure.
    &pi ) // Pointer to PROCESS_INFORMATION structure.
    )
    {
    // ErrorExit( "CreateProcess failed." );
    }

    // Wait until child process exits.
    WaitForSingleObject( pi.hProcess, INFINITE ); // it would only be
    notified when the IE is killed.
    //WaitForInputIdle(pi.hProcess, INFINITE);
    DeleteFile(random.html);
    yyii, Aug 31, 2003
    #1
    1. Advertising

  2. "yyii" <> wrote in message
    news:bit6ep$nfk$...
    > Hi,
    >
    > I have a problem on retreiving the status of the child process. I want to
    > open IE and load local file. Just after it is loaded, I need to delete

    that
    > local file. It seems that I can't use the function
    > WaitForInputIdle/WaitForSingleObject in this situation. Please advise how

    I
    > can be notified once the IE is completed reading the file. Many thanks!
    >


    You need a group for Windows programming, this group is about the C++
    language, and there is no C++ language issue in your post. Try
    news:comp.os.ms-windows.programmer.win32 for instance, and try learning some
    netiquette before posting again.

    john
    John Harrison, Aug 31, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page