Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Shutting down app
Message
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00388798
Message ID:
00393882
Views:
31
>I've got an app where I need to be able to shutdown the program via a button on a form then start up another program. The code looks like:
>
>goApp.OnShutDown()
>ShellExec(lcApp, "open", "Z", lcAppPath)
>
> The ShellExec works fine, but I get an "Object does not exist" error when using the OnShutDown() call. I'm assuming that's because of the shutdown order (ie. an object the form is depending on is released before the form is). Is there some other way I should be handling this?


Just a follow up to this. It looks like the reason this fails is because, during the shutdown, the calling form's Release() method is called. It won't release (since it's still running the OnShutDown() code). Then the shutdown will fail.

I got around this by changing my code in the Click() method on the calling form to:

ShellExec(lcApp, "open", "Z", lcAppPath)
goApp.AddObject('oOnShutDownTimer', 'OnShutDownTimer')
THISFORM.Release()

I'm adding a timer object to the goApp object. It waits a few seconds then fires the goApp.OnShutDown() method. In the meantime the form is released. It works like a charm.
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform