CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2008
    Posts
    18

    How to call another program?

    Hi, I'm working on a program that can execute another program. I'm doing so because I need to run 2 different loops at once, and I don't know how to do that in one program. So my question is, how do I call to another program within my original program?
    I'm aware of the std:system("filename") function. But when I call this function, the original program pauses and wait until the called program terminates. I need a function that can execute another program while the original still runs.
    Thanks!

  2. #2
    Join Date
    May 2005
    Posts
    4,954

    Re: How to call another program?

    Look at this FAQ : How can I start a process?

    Cheers
    If a post helped you dont forget to "Rate This Post"

    My Article: Capturing Windows Regardless of Their Z-Order

    Cheers

  3. #3
    Join Date
    Aug 2004
    Posts
    294

    Re: How to call another program?

    For the described problem

    Threads

    seem more appropriate.
    Last edited by Boris K K; March 14th, 2008 at 05:14 AM.
    Boris Karadjov
    Brainbench MVP for Visual C++
    http://www.brainbench.com/

  4. #4
    Join Date
    May 2005
    Posts
    4,954

    Re: How to call another program?

    Quote Originally Posted by Boris K K
    For the described problem

    Threads

    seem more appropriate.

    Why using threads? if he will use ::CreateProcess() his original program will continue to run after the call to ::CreateProcess() without waiting for the external program to finish.....

    Or maybe I misunderstood the question..

    Cheers
    If a post helped you dont forget to "Rate This Post"

    My Article: Capturing Windows Regardless of Their Z-Order

    Cheers

  5. #5
    Join Date
    Aug 2004
    Posts
    294

    Re: How to call another program?

    I believe this is the true problem that needs solving:

    Quote Originally Posted by C++N00bie
    I'm doing so because I need to run 2 different loops at once, and I don't know how to do that in one program.
    and in Windows environment threads are better solution to it than processes. *NIX is another matter...
    Last edited by Boris K K; March 17th, 2008 at 04:36 AM.
    Boris Karadjov
    Brainbench MVP for Visual C++
    http://www.brainbench.com/

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