Application.exe is still running after closing

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
DavJans
Posts: 275
Joined: Thu Dec 12, 2013 4:21 pm

Application.exe is still running after closing

Post by DavJans » Mon Feb 27, 2017 10:15 pm

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?
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: Application.exe is still running after closing

Post by dunbarx » Mon Feb 27, 2017 10:35 pm

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Application.exe is still running after closing

Post by FourthWorld » Mon Feb 27, 2017 10:54 pm

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
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

DavJans
Posts: 275
Joined: Thu Dec 12, 2013 4:21 pm

Re: Application.exe is still running after closing

Post by DavJans » Mon Feb 27, 2017 10:55 pm

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.
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: Application.exe is still running after closing

Post by dunbarx » Mon Feb 27, 2017 11:43 pm

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

Post Reply