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

    Question Pause thread while another program runs

    I'm writing a small program which checks to see if a handful of other programs are installed on the user's machine. If they aren't, my application will launch the setup files for them. I've already figured out how to check the registry for the other programs and launch the setup files... but I want my program to "pause" while each setup is running, and start back up when each setup is finished. This is so they don't open all at once.

    Any ideas?

    THANKS!

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Pause thread while another program runs

    When you start the process using the Process class, just call the Wait.For.Exit (minus the dots) method to wait for the process to finish.

    Tip: if your application has a UI, launch the processes (using the Process class) in a separate thread. If you don't, then your UI will freeze during the Wait.For.Exit( ) call.

  3. #3
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Pause thread while another program runs

    I'd have to suggest Powershell 2.0 CTP. You can easily create scripts as well as execute (via INVOKE command-let objects) them, using the -wait parameter for each step.

    ( it took me *way* too long to figure that out)
    just call the Wait.For.Exit (minus the dots)
    * must be a RESERVED command, not hiding the S in BS
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  4. #4
    Join Date
    Feb 2009
    Posts
    4

    Talking Re: Pause thread while another program runs

    Works perfectly!! Thanks so much!

Tags for this Thread

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