Matt,
This is what I do in "McPhling".
static void VFSRunApp(VFSInfo *vfsInfo, Int16 vfsVolIndex, Char *vfsPath,
UInt16 *cardNoP, LocalID *dbIDP, UInt32 creator,
Boolean bVgaExists)
{
Err err;
VFSLast vfsLast;
DmOpenRef dbHack;
FormPtr pNewForm = NULL;
VgaScreenModeType screenMode;
VgaRotateModeType rotateMode;
FormPtr pForm = FrmGetActiveForm();
dbHack = DmOpenDatabaseByTypeCreator(APP_TYPE, APP_ID, dmModeReadOnly);
DisplayWaitForm(bVgaExists, &screenMode, &rotateMode, &pNewForm);
err = VFSImportDatabaseFromFile(vfsInfo->vfsVol[vfsVolIndex].volRefNum,
vfsPath, cardNoP, dbIDP);
DmCloseDatabase(dbHack);
if(err == errNone) {
SysAppLaunchCmdCardType sysAppLaunchCmdCardType;
// UInt32 result;
sysAppLaunchCmdCardType.err = expErrUnsupportedOperation;
sysAppLaunchCmdCardType.volRefNum =
vfsInfo->vfsVol[vfsVolIndex].volRefNum;
sysAppLaunchCmdCardType.path = vfsPath;
sysAppLaunchCmdCardType.startFlags = sysAppLaunchStartFlagNoUISwitch;
// Removed because this caused the device to crash if MGI Photosuite
// was run from a VFS volume
/*
err = SysAppLaunch(*cardNoP, *dbIDP, 0, sysAppLaunchCmdCardLaunch,
&sysAppLaunchCmdCardType, &result);
if(err == errNone)
*/
err = SysUIAppSwitch(*cardNoP, *dbIDP, sysAppLaunchCmdNormalLaunch,
NULL);
// save preference so that McPhling knows which applicaiton to delete
// when it has exited
vfsLast.creator = creator;
PrefSetAppPreferences(APP_ID, VFSLAST, 0, &vfsLast, sizeof(vfsLast),
true);
}
RemoveWaitForm(bVgaExists, screenMode, rotateMode, pNewForm, pForm);
}
Since "McPhling" is a hack, I can delete the application from memory when the
next application runs.
You can find the source code at
http://MikeMcCollister.com/palm/McPhlingSource.zip.
I hope that this helps.
Mike McCollister
--- Matthew Henry <[EMAIL PROTECTED]> wrote:
> Anyone know a good way to launch an app located on a MS/SD Card from another
> app?
>
> I have tried copying the card app to local memory and using SysUIAppSwitch.
> This works fine, but of course the DB does not get deleted when the app
> quits.
>
> I tried using SysAppLaunch to launch it as a sub app. Theoretically when
> the sub app quits I could then delete the local DB. But SysAppLaunch
> appears not to work with C++ applications; the global variables in the "sub"
> app do not get initialized and the app crashes. Grr. Any new programs I
> write for the Palm will be written in C.
>
> I tried using SysUIAppSwitch to have the "sub" app switch back to my initial
> app when it is done. The initial app can then delete the "sub" app. That
> *almost* works. But if you, say, hit the palm's "address" button when the
> sub app is running, the initial app will get switched to and the sub app
> will get deleted, but the address application will never be called.
>
> It's quite a pickle.
>
> Anyone have any ideas? I might be able to solve this using a system trap,
> but I would like a solution that will work on OS 3-5.
>
> Matt Henry
> www.iliumsoft.com
>
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe, please
> see http://www.palmos.com/dev/support/forums/
__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/