Page 1 of 1
Application.exe is still running after closing
Posted: Mon Feb 27, 2017 10:15 pm
by DavJans
I think it may have something to do with loops, I have 2 loops that keep repeating and then waiting minutes before they do stuff again. is there a way to force these to stop when closing the application?
Re: Application.exe is still running after closing
Posted: Mon Feb 27, 2017 10:35 pm
by dunbarx
Hmmm.
Try this. On a new card in a new stack, place a field and a button. In the button script:
Code: Select all
on mouseUp
repeat until the optionKey is down
put random(999) into fld 1
wait 3 --with messages -- (try this uncommented as well)
end repeat
end mouseUp
If you try to quit LC, you will queue the attempts to do so, and see them all when you hold down the option key. If you include the "with messages", you can quit right away.
Sort of.
Let me know what you think.
Craig Newman
Re: Application.exe is still running after closing
Posted: Mon Feb 27, 2017 10:54 pm
by FourthWorld
You can kill all pending messages with this:
Code: Select all
on KillAllTimers
repeat for each line tMsg in the pendingMessages
cancel (item 1 of tMsg)
end repeat
end KillAllTimers
Re: Application.exe is still running after closing
Posted: Mon Feb 27, 2017 10:55 pm
by DavJans
well that definitely works as expected, When I close the application without pressing the option key, it stays running in the task manager until alt is pressed. However I cant ask the user to never use the alt key, or it might get pressed by accident prematurely stopping the loop. Also there is a 5 minute wait timer. not 3 milliseconds. I really appreciate the response.
Re: Application.exe is still running after closing
Posted: Mon Feb 27, 2017 11:43 pm
by dunbarx
Richard makes an important observation concerning how LC works internally. But this may not help you or your users unless perhaps (untested) a "closeStackRequest" message is trapped and his handler invoked.
I only put in the optionKey thingie so neither of us would get stuck. I never intended it to be used in "production".
This is a case where it may be desirable to rethink methodology. Sometimes, when the kluges get too complicated, it is time to go back a few steps and see if a different approach makes all that go away.
Craig