> DO WHILE .T. > * Use timeout of TIMEOUT_INTERVAL msec so the display > * will be updated. Otherwise, the VFP window never repaints until > * the loop is exited. > IF WaitForSingleObject(hProcess, WAIT_INTERVAL) != WAIT_TIMEOUT > EXIT > ELSE > DOEVENTS > ENDIF > ENDDO > >>
>local ProcessExitCode, WaitExitStatus, hThread >ProcessExitCode = 0 >hThread = str2long(SUBSTR(process_info, 5, 4)) > > >&& at least wait for the process to start completely >&& ProcessExitCode = -1 is process gone (I think) > >ProcessExitCode = WaitForInputIdle(m.hProcess, 0xffffffff) > >if( m.hProcess = 0 ) > && not there > >else > > > do while TRUE > =WaitWindowAtMouse('Waiting for process ...') > > WaitExitStatus = WaitForSingleObject(m.hProcess , 5000-4500) > > do case > case m.WaitExitStatus = 0x102 && Timed out > > case empty(m.WaitExitStatus) && gone > do case > case empty( GetExitCodeProcess(m.hProcess , @m.ProcessExitCode) ) > assert FALSE > ProcessExitCode = -1 > otherwise > > endcase > exit > > otherwise > assert FALSE > exit > endcase > > enddo > =WaitWindowAtMouse() > >endif > >=CloseHandle(m.hThread) > >*------------------------------------------------------------------------------- >function WaitWindowAtMouse(msg) > > if( !empty(m.msg) ) > wait window nowait at mRow(_screen.name), mCol(_screen.name) m.msg > else > wait clear > endif >endfunc >*-------------------------------------------------------------------------- >