Try setjmp/longjmp at and to the point you'd like to be your exit point.I did that with the Palm macros for exception handling. My main routine looks like this:
static UInt32 StarterPalmMain(UInt16 cmd, void */*cmdPBP*/, UInt16 launchFlags)
{
if (cmd == sysAppLaunchCmdNormalLaunch)
{
// The execution of the application is enclosed by the OS try/catch mechanism.
// This allows exiting the application from anywhere (e.g. Device::panic).
ErrTry
{
Err error = AppStart(launchFlags);
if (error != errNone)
return error;
FrmGotoForm(MainForm);
AppEventLoop();
}
ErrCatch(inErr)
{
// Application failure. Cleanup work will be done by AppStop later.
} ErrEndCatch
AppStop();
return errNone;
}
else
{
return errNone;
}
}If I want to exit the application I do this:
void Device::panic(const Char *message)
{
FrmCustomAlert(DevicePanicAlert, message, NULL, NULL);
ErrThrow(0L);
}Hope this helps, Tilo
--------------------
Jeff Loucks
Work 425-284-1128 [EMAIL PROTECTED]
Mobile 253-691-8812 [EMAIL PROTECTED]
Home 253-851-8908 [EMAIL PROTECTED]
-----Original Message-----
From: Ornstein, Adam [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 12, 2004 1:19 PM
To: Palm Developer Forum
Subject: RE: how to exit()
You can always post a appstop event... but it wont stop the application in it's tracks.
-----Original Message-----
From: Matt Graham [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 12, 2004 4:12 PM
To: Palm Developer Forum
Subject: how to exit()
Let's say my program recognizes a (relatively) catastrophic state in which I want to just display an error message and exit. Is there an equivalent to exit() that I could call that would stop execution from where ever I call it?
Thanks, matt
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
