wait external process to terminate

BlitzMax Forums/BlitzMax Beginners Area/wait external process to terminate

Smokey(Posted 2011) [#1]
Hi

here what I want to accomplish, I want to start an external program
this program will auto close when it finish and I want to detect when this process is no longer active to continue the code.

I tried to find the answer on the forum but nothing.

it's there a way to accomplish this.


Naughty Alien(Posted 2011) [#2]
http://www.blitzbasic.com/Community/posts.php?topic=86528#980982


Smokey(Posted 2011) [#3]
Thanks

I came accros another problem

When I use process
Strict
Import maxgui.drivers
Global EditWindow:TGadget
Global FLAGS:Int

FLAGS:|WINDOW_TITLEBAR
FLAGS:|WINDOW_ACCEPTFILES
FLAGS:|WINDOW_TOOL
FLAGS:|WINDOW_CENTER

EditWindow = CreateWindow("Initiate program please wait", 0, 00, 444, 165, Null, FLAGS)
Global hwnd:Int = QueryGadget(EditWindow, QUERY_HWND)
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE)

Local str:String = "pre.exe /aif"
Local process:TProcess = CreateProcess(str, HIDECONSOLE)
Local bContinue:Int = 1

While bContinue = 1
   If ProcessStatus(process:TProcess) = False
      bContinue= 0
   EndIf
Delay(50)
Wend

End


it's work pretty well but I use createwindow() and when I call the process the windows lost focus and it goes into background doing the job so I use I put the windows on topmost, even with ActivateWindow or ActivateGadget does't work the windows is seem to be no longer active, if I put Notify "active" after the While it's work the windows get active again and I can interact with it again so I wonder what may be wrong

Last edited 2011