Is there such a function? An API?
Just something to stop absolutely everything... Disable and stop all timers, while loops, events, everything... Is it possible?
I'm not sure it is...
Thanks.
Printable View
Is there such a function? An API?
Just something to stop absolutely everything... Disable and stop all timers, while loops, events, everything... Is it possible?
I'm not sure it is...
Thanks.
I assume you mean a given program, rather than the 'Off' Switch.
Normally Unloading all the loaded forms will shutdown a program fairly gracefully, but there's no substitute for good programming practice. The code should allow for just about every possibility and tidy-up accordingly.
Do you have a specific problem or is this just an information gathering exercise?
No, I don't mean exiting or unloading, sorry if I was misleading. I mean, keep everything open, but have it in the state it was when it opened.... IE. nothing happening. Just like... a reset button.
EDIT: I'd rather gather knowledge from people on specific things, that know what they're doing... Its a hobby.
EDIT2: No it's not a hobby to gather information lol... Using VB6 is my hobby.
You'd have to design the Application to allow for that. For example if you have loops you'd need some way of each loop recognising a signal to stop, perhaps a Global Boolean variable that is checked each time round the loop and if it's set, then the loop would exit gracefully followed by the Function / Subroutine and then the Form(s) - closing Files, Database connections, setting objects = Nothing etc - until you're left with the Start-up form. Stopping Timers is simple just use Timer.Enabled = False for each Timer when the 'Reset' button is pressed.
You could load an invisible Form which Unloads the Start-up Form, loads it again and then unloads itself.That would re-initialise all the Variables and Controls in the Start-up Form, and away you go.
Thanks Doogle, ill give it a shot. :)
Another part of a reset would be to iterate through all controls and reset them to empty.