How to properly exit program
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
How to properly exit program
I have written a small LC program for Windows that is essentially meant to start, do some work, then exit.
When I compile it to standalone, I can't seem to get it to exit. It stays running in memory.
I've tried everything I can think of but obviously am missing something.
Also should I run my code all in the On Startup?? or on a preopen??? I'm a bit confused when the various Card and Stack events fire.
For example, I am running everything in On Startup, and part of what I'm doing is geocoding an address via http, but it doesn't seem to work when compiled, but works fine if I step thru the Card via debugger.
Thanks for any help. Feel free to point me to other places that will help me learn. I did look at the Dictionary, but it seems mostly helpful when you know what you're looking for. I have Commercial license.
When I compile it to standalone, I can't seem to get it to exit. It stays running in memory.
I've tried everything I can think of but obviously am missing something.
Also should I run my code all in the On Startup?? or on a preopen??? I'm a bit confused when the various Card and Stack events fire.
For example, I am running everything in On Startup, and part of what I'm doing is geocoding an address via http, but it doesn't seem to work when compiled, but works fine if I step thru the Card via debugger.
Thanks for any help. Feel free to point me to other places that will help me learn. I did look at the Dictionary, but it seems mostly helpful when you know what you're looking for. I have Commercial license.
Re: How to properly exit program
Hi,
Sounds like you do not need a visual representation of your stack at all, right?
In that case I would do something like this:
Not tested, but sounds like this will work 
Best
Klaus
Sounds like you do not need a visual representation of your stack at all, right?
In that case I would do something like this:
Code: Select all
on preopenstack
## So the user will not see anything on screen
set the visible of this stack to false
end preopenstack
on openstack
## do your stuff here...
## More stuff to do here...
## Done? Then:
quit ## :-)
end openstack

Best
Klaus
Re: How to properly exit program
Klaus,
I will try this tonight and let you know how it works.
Thanks
I will try this tonight and let you know how it works.
Thanks
Re: How to properly exit program
Libraries do not load on startup, so the internet library you're using won't be available until after the card opens. That's why it isn't working in your standalone. In the IDE, the libraries are all loaded already by the time it opens your stack.
Apps will remain in memory if there is any process still open -- that can be a driver or any pending messages or actions. Make sure that anything a script has started is actually stopped before the app quits. Check if you have any pending messages in the queue or if the http call is waiting for a response.
Apps will remain in memory if there is any process still open -- that can be a driver or any pending messages or actions. Make sure that anything a script has started is actually stopped before the app quits. Check if you have any pending messages in the queue or if the http call is waiting for a response.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: How to properly exit program
Jacque
Makes perfect sense and explains what I'm seeing.
I will make changes tonight.
Lots to learn but love being here.
Makes perfect sense and explains what I'm seeing.
I will make changes tonight.
Lots to learn but love being here.
Re: How to properly exit program
To quit properly, look at the script written by Mark :
http://forums.runrev.com/viewtopic.php?t=1026
http://forums.runrev.com/viewtopic.php?t=1026
Re: How to properly exit program
Thanks everyone. My program is now working and exiting also.
Cool
Cool
Re: How to properly exit program
Just out of curiosity, what was it?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: How to properly exit program
I ended up using the code from Klaus, running my stuff at "on openstack" and then quitting. It's a simple program, I made sure I closed the database, etc, first.
Thanks again everyone.
Thanks again everyone.