Subject: Re: Strange error when trying to intercept sysNotifyVolumeMountedEvent
From: "Chris Tutty" <[EMAIL PROTECTED]>
Date: Fri, 29 Apr 2005 12:12:53 +1200
X-Message-Number: 31
From: "Dr. Vesselin Bontchev" <[EMAIL PROTECTED]> > Help? Is this the correct way for an application to launch itself with a custom launch code and to check whether this is how it has been launched? > If I recall correctly, some apps handle notifications by setting an alarm that will launch their app normally in a second or so. This gives the OS activity associated with the notification time to settle down. It seems to me that in attempting to immediately transfer control to the same app you are setting yourself up for timing and event-queue issues, although I've never attempted to do anything like this.
Perhaps in response to the sysNotifyVolumeMountedEvent you need to do the following:
1) Disable the autorun of start.prc (as Ben already suggested) 2) Setup a notification, alarm or event to run your program (in background) 3) Exit
When your program is subsequently called from the notification/event/alarm you generated:
1) Scan the start.prc program
2) If clean, run it by sending an appropriate notification.
Some of the PalmOS events and notifications only support lightweight or minimal processing and expect you to delay anything more significant to a later time. I suspect your problems are caused by violating this rule.
One useful Palm OS characteristic is that alarms are not responded to at certain points like this, so by setting an alarm for "now" during this period, the alarm will actually be called right after the OS processing has finished. A classic use of this is responding to the HotSync event, where the program receiving the event isn't supposed to do more than trivial processing and the common trick is to set an alarm, taking advantage of the suppression of alarms during HotSync, which ensures your program is called right after HotSync completes.
Roger Stringer Marietta Systems, Inc. (www.rf-tp.com)
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
