Reliable way to do something on shutdown?

Paul D. DeRocco pderocco at
Tue Jun 18 20:07:21 EDT 2013

My app uses an external, which if not properly closed causes LiveCode, or my
standalone, to remain as an orphan process under Windows until I forcibly
kill it. So far, I haven't figured out how to intercept the shutdown when it
comes from the close button in the corner of the window.

First, I tried adding a "shutdown" handler to my main stack, which didn't
work. Then, I noticed the note in the Dictionary, and created an invisible
button which had a "shutdown" handler, and made its script a backscript, but
that didn't work. Then, I noticed that the Dictionary said that "shutdown"
is sent to the current card of the defaultStack, and not the stack itself,
so I gave the card a "shutdown" handler, but that didn't work.

I don't really care if there's some reason this can't work in the IDE, since
I can just remember to manually close the external. But it has to work in
the standalone.

My app, in case it matters, has a main stack with one card, and three
subsidiary stacks for modal dialog boxes, none of which are open when the
program is shut down. It works fine if I call "quit" from a menu handler,
but not when I click the X in the corner. What's the right way to do this?


Ciao,               Paul D. DeRocco
Paul                mailto:pderocco at 

More information about the Use-livecode mailing list