CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 1999
    Posts
    10

    Waiting for termination

    I am trying to make a Win 32 application(DOS only) that will launch a program and wait until it terminates in Visual C++ 5. It also has another thread that updates a file every minute(launched with _beginthread). The problem I run into is that I do not know how to launch a program and wait for it to terminate. Could someone please help me with this?

    Thanks.


  2. #2
    Guest

    Re: Waiting for termination

    Try the WaitForSingleObject() API call.
    Use the handle returned from _beginthread to identify the object to
    wait for.



  3. #3
    Join Date
    Apr 1999
    Posts
    10

    How would I...

    ...launch the application(and arguments) with _beginthread?


  4. #4
    Guest

    Re: How would I...

    >>...launch the application(and arguments) with _beginthread?

    You don't. I misunderstood. However, within an application you can
    detect thread termination using WaitForSingleObject. The beauty of
    this call is that the handle passed can be a handle to all manner of
    things. You can lauch your application by calling CreateProcess, and
    the handle returned will identify it. Then call WaitForSingleObject
    passing the process handle and you will detect when the process has
    ended. Hope this helps.




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured