how can I keep a program running ...

BlitzMax Forums/BlitzMax Programming/how can I keep a program running ...

ckob(Posted 2006) [#1]
when not focused? I have a program that I want to idle in the background which watches another program and if that program crashes this program I am writing will restart it. I just need to know how to keep it running in the background because when its out of focus it wont execute the program and it sort of freezes.


Gabriel(Posted 2006) [#2]
Events. Make it react to whatever event you want. If you want it to monitor something, your best bet is probably to create a timer and have your program check every time the timer ticks.


ckob(Posted 2006) [#3]
yeah I tried that but waitevent seems to mess that up because its halts the program until an event is done.


Regular K(Posted 2006) [#4]
If PollEvent()
Select EventID()
...
End Select
endif


Use PollEvent(), not WaitEvent().


ckob(Posted 2006) [#5]
tried that and it seems to work, but once it restarts my other program then it stops responded.


H&K(Posted 2006) [#6]
either 1) Its a bug. 2)Youve done somthing wrong

I think its out of order to post "How do I do This", when you mean "I know you do it like this, but it doesnt work"
EDIT. Rephrase to "I think its bad post policy to post...


ckob(Posted 2006) [#7]
Well my app doesnt have much to it and I cant see any reason why it would stop responding when it executes another program. I am not sure what you mean about this post being out of order?


Dreamora(Posted 2006) [#8]
How is it executing something else?
Through createprocess or system_ ?

The later will put it on hold as execfile in B3D does as well and your app will go on where it was after the executed file finished.

CreateProcess should not suffer this problem unless the started app takes 100% cpu in which case your "starter app" could get out of "sync" with its timer ...


ckob(Posted 2006) [#9]
ah thats why then :) because I am using system_ ill give it a shot at home thanks dreamora