I thought that the Launcher can launch applications only from the
/PALM/Launcher folder? Well, that and the /PALM/start.prc allication - but that
one doesn't receive the sysAppLaunchCmdCardLaunch launch code. Oh, well, maybe
the Launcher of LifeDrive is more advanced in this aspect.
Anyway, back to your question. You could, for instance, copy the path that is
passed to you as a parameter in a freshly allocated memory block, mark this
block as owned by the OS (so that it doesn't get freed when your application
exits), and store a pointer to that block in a feature. In other words,
something like this:
#define ftrPath 1000
UInt32 PilotMain (UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
{
UInt32 creatorID;
UInt16 cardNo;
LocalID dbID;
Char *path, *savedPath;
switch (cmd)
{
case sysAppLaunchCmdCardLaunch:
path = ((SysAppLaunchCmdCardType *) cmdPBP)->path;
savedPath = (Char *) MemPtrNew (StrLen (path) + sizeOf7BitChar
(chrNull));
StrCopy (savedPath, path);
MemPtrSetOwner (savedPath, 0);
SysCurAppDatabase (&cardNo, &dbID);
DmDatabaseInfo (cardNo, dbID, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, &creatorID);
FtrSet (creatorID, ftrPath, (UInt32) savedPath);
break;
case sysAppLaunchCmdNormalLaunch:
SysCurAppDatabase (&cardNo, &dbID);
DmDatabaseInfo (cardNo, dbID, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, &creatorID);
FtrGet (creatorID, ftrPath, (UInt32 *) savedPath);
ErrAlertCustom (0, savedPath, 0, 0);
MemPtrFree (savedPath);
FtrUnregister (creatorID, ftrPath);
break;
default:
break;
}
return errNone;
}
Disclaimer - I haven't tried this code, so I don't guarantee that it works -
but the general idea should work.
Regards,
Vesselin
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/