I have a bit of a problem. I wrote a read-only front end to the Datebook and
ToDo databases, and upon clicking an item I use sysAppLaunchCmdGoTo to launch
an application with the appropriate GoToParamsType structure. Everything is
fine except that I've now added the option to launch applications other than
the default Datebook and ToDo.
Well it turns out that I can find no way to determine if it is appropriate
for me to sysAppLaunchCmdGoTo a particular application on the device. If it
doesn't support it, it will ignore it.. but OTOH if it does support
sysAppLaunchCmdGoTo there is no guarantee that it will perform all of the
necessary safety checks on the GoToParamsType to ensure that it can handle
the goto for that particular record.
So here is my question. What is the most sensible thing to do. I don't want
my application being a catalyst for a fatal error because I allow the user to
pick an inappropriate launch target. Yet there is no way to determine which
applications can successfully handle a sysAppLaunchCmdGoTo for a particular
database. It doesn't help much that the built-in applications do stuff like
this (no error checking):
recordH = DmQueryRecord (ToDoDB, recordNum);
toDoRec = (ToDoDBRecordPtr) MemHandleLock (recordH);
Hence if I launch ToDo with a GoToParamsType set up for a Datebook record, it
will a) not verify the dbid and b) attempt a record query with an
inappropriate record number which will likely (and does in many cases) fatal
error because it doesn't check for the error.
In the meantime I have chosen to create a short-list of appropriate
sysAppLaunchCmdGoTo capable creator-ids and I only attempt the launch for
them, and otherwise I'll do a normal launch. This is safe, but otherwise
very annoying because I have to hand test all of the Datebook/ToDo
replacements and they seem to crop up with new ones every week.
Should I just assume that just the original Datebook/ToDo applications have
this weak code :) in them, and trust the rest of the applications?
/* Chris Faherty <[EMAIL PROTECTED]>, finger for PGP */