CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Waiting for a DOS application to terminate?

  1. #1
    Join Date
    Apr 1999
    Location
    Germany
    Posts
    64

    Waiting for a DOS application to terminate?

    Hello.

    I want to write a windows frontend for a DOS tool.

    So I call the DOS app and the DOS box pops up.
    Then I have to wait until it has finished
    before I can proceed. But how do I know?

    I tried to use FindWindow() and look periodically
    for a window title with my DOS application name.
    But that is e.g. different in WinNT as in Win98.

    Any solutions?

    BR,
    Díetmar


  2. #2
    Join Date
    May 1999
    Location
    Germany
    Posts
    106

    Re: Waiting for a DOS application to terminate?

    Hi,

    Use OpenProcess to get a handle to the process.
    (Or use CreateProcess to create the process and to obtain the process handle)
    Then use WaitForSingleObject to wait for its termination.

    Bye
    Peter


  3. #3
    Join Date
    Apr 1999
    Location
    Germany
    Posts
    64

    Re: Waiting for a DOS application to terminate?

    Do you mean this?

    WaitForSingleObject
    (hHandle, // = hProcess from struct PROCESS_INFORMATION
    timeout);


    In Win98 the DOS box is still visible after termination.
    Does this work anyway?


  4. #4
    Join Date
    May 1999
    Location
    Germany
    Posts
    106

    Re: Waiting for a DOS application to terminate?

    Hi,

    yes, it's the hProcess member of the PROCESS_INFORMATION structure.

    I don't know what happens when the dos-box keeps visible. Try following:
    STARTUPINFO's dwFlags contains STARTF_USESHOWWINDOW
    STARTUPINFO's wShowWindow is SW_HIDE

    Bye
    Peter


Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)