tags:

views:

177

answers:

1

I am using c++ in borland development studio to launch a process. After the process is launched, the parent application is supposed to wait for it, but still keep processing windows messages.

I tried using spawnl with P_WAIT after launching a timer, but timer wont fire when thread is blocked, i also tried using spawnl with P_NOWAIT together with cwait, but that didnt work either.

any suggestions ?

many thanks

+1  A: 

Are you waiting for the process to complete in a method that handles Windows messages? If you wait for the new process in a button-click handler, Windows won't process any more messages until the button-click method completes.

If you need timer-based background processing you have a few options:

  1. Create a thread to wait for the process to complete.
  2. Create a new timer that checks periodically with WaitForExit() to determine when the other process completes.
  3. In your current handler, call Windows WaitForExit() using your timer period as the argument. If the process isn't complete when WaitForExit() returns, do the timer-based processing. Note that this option still results in no Windows messages being processed.
Don