wait for Windows application to finish 
Author Message
 wait for Windows application to finish

I'm having some success with the technique mentioned in ruby-talk:
30733, 15050, etc. for running Windows apps from Ruby scripts.  But does
anybody know of a way to vary the Win32API crtdll call so it does not
return until the application it launched is done running? Or does crtdll
just not support it?

  Mark



Sat, 03 Jul 2004 20:29:32 GMT  
 wait for Windows application to finish

Quote:

> I'm having some success with the technique mentioned in ruby-talk:
> 30733, 15050, etc. for running Windows apps from Ruby scripts.  But
> does anybody know of a way to vary the Win32API crtdll call so it does
> not return until the application it launched is done running? Or does
> crtdll just not support it?

>  Mark

Added note: this does seem to be the default behavior in W2000 but not
in W95/98. What I'd like is to make the call wait, regardless of Windows
version. At the moment I'm trying to do this with the mingw32 1.6.6
build, in case that matters (I suspect it doesn't).

  Mark



Sat, 03 Jul 2004 20:50:42 GMT  
 wait for Windows application to finish


Quote:

>> I'm having some success with the technique mentioned in ruby-talk:
>> 30733, 15050, etc. for running Windows apps from Ruby scripts.  But
>> does anybody know of a way to vary the Win32API crtdll call so it does
>> not return until the application it launched is done running? Or does
>> crtdll just not support it?

>>  Mark

>Added note: this does seem to be the default behavior in W2000 but not
>in W95/98. What I'd like is to make the call wait, regardless of Windows
>version. At the moment I'm trying to do this with the mingw32 1.6.6
>build, in case that matters (I suspect it doesn't).

Let me see if I understand correctly, you mean that if you redefine
'system' like:
require 'Win32API'
def system(command)
  Win32API.new("crtdll", "system", ['P'], 'L').Call(command)
end

that on Win2000 if you run a windows app using the redefined system that
the app is launched but does not wait for that app to finish and returns
to executing the next line of your script immediatly? (That's bad news!)

I'm not sure how to remedy this easily from Win32API calls.  I know that I
was able to run on Win[95|98|NT] using my own Win32::Process (I'm
reasonably sure it'll run on Win2K as well).  If
you want you can download it from: http://www.aracnet.com/~ptkwt/  (Win32
Extension library).  You use it like:

   require "win32process"
   myProcess = Win32::Process.new("c:\\Windows\\notepad.exe","notepad
tmp.txt",TRUE,Win32::CREATE_NEW_PRODUCT_GROUP,".")
   #check the process id:
   puts myProcess.pid
   #wait 1 second:
   myProcess.wait(1000)
   #if you want you can kill the process:
   myProcess.kill(exitCode) #where exitcode is an integer

I've never compiled this extension with mingw, though.

Phil



Sun, 04 Jul 2004 02:11:37 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Wait until program finish on CW5ee

2. RUN used in program, but not waiting for process to finish

3. waiting for `backquotes` to finish

4. Waiting for processes to finish under Solaris

5. One proc does not wait until one another finished

6. calling a program without waiting for it to finish

7. waiting for an exec'ed process to finish

8. How to wait until exec is finished?

9. Problem waiting for window to finish drawing

10. Waiting for PowerRUN() 'ed application to finish under NT - SOLVED!

11. My application, after being application build is terminated by Windows

12. HELP! Interfacing prolog application with MS-WINDOWS application

 

 
Powered by phpBB® Forum Software