Thread: Background Processes

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    4

    Question Background Processes

    Hi! This question has two parts. It involves Visual C++ 6.0 to
    create a program that will be run on various types of Windows
    platforms.

    1. I'm looking for a way to run an executable as a background
    process from inside the program. execl() won't allow this, I
    believe.

    2. I'm looking for a way to stop that same background process
    from inside the program.

    I haven't found anything yet and any help any of you might give
    would be appreciated.

    Thanks!

    Karin
    (Hammer)

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    one simple way is to pass an HWND as a command line parameter and PostMessage back and forth between windows (the background window can be hidden).
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Moving ...
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  4. #4
    Registered User
    Join Date
    May 2003
    Posts
    4
    Unfortunately the executable we are using is proprietary
    software. I can't modify the handle of this program. It's
    already set up to be a windows app.

    It wouldn't be so much of an issue if we could trust
    everyone not to kill it....

  5. #5
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    Lookup CreateProcess()

  6. #6
    Registered User
    Join Date
    May 2003
    Posts
    4
    Ok, I'm going to try that and see if it will work with this
    App.

    Thanks much!

    Karin

  7. #7
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    Yeah, give it a shot and keep us posted...

    iamhammer42's signature:
    I can help you build your house
    or I can help you tear it down.
    I am hammer....
    Heheheh... Nice sig.. Real intimidating ; P

  8. #8
    Registered User
    Join Date
    May 2003
    Posts
    4
    CreateProcess worked wonderfully. Of course now I can't get rid of the process I created. It creates two processes:

    VCSPAWN.exe and
    <program.exe>

    VCSPAWN.exe goes away when the program exits but the
    other program stays.

    I've tried ExitProcess, TerminateThread ( I know to stay away
    from TerminateProcess). The only thing I get out of
    GetExitCodeProcess and GetExitCodeThread is the number 259.
    Doesn't matter what I do. The examples I've seen when using
    ExitProcess have been in the 0 - 1 range. Something is very
    wrong here.

    Help!

    Karin

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 34
    Last Post: 05-27-2009, 12:26 PM
  2. Processes not dying
    By Elkvis in forum Linux Programming
    Replies: 12
    Last Post: 04-23-2008, 08:59 AM
  3. binary tree of processes
    By gregulator in forum C Programming
    Replies: 1
    Last Post: 02-28-2005, 12:59 AM
  4. Detect Close of a background process
    By Schwarzhelm in forum C Programming
    Replies: 1
    Last Post: 11-05-2003, 01:46 AM
  5. Computer Processes.... Which can be stopped?
    By Sevrin in forum Tech Board
    Replies: 3
    Last Post: 06-08-2003, 08:13 PM