Utility method I had laying around:

// Relaunches an application with globals enabled.
//    creatorID -- the creatorID of the application
//    cmd       -- the launch code
//    cmdPBP    -- the launch parameter block
//    ret       -- holds the return value after the launch
// Returns: non-zero if the launch failed

Err RelaunchWithGlobals( ULong creatorID, Word cmd,
                         Ptr cmdPBP, DWord *ret )
{
    UInt              card;
    LocalID           id;
    Err               err = sysErrNotAllowed;
    DmSearchStateType stateInfo;

    if( DmGetNextDatabaseByTypeCreator( true, &stateInfo,
                                        'appl', creatorID,
                                        true, &card, &id ) == 0 ){
        err = SysAppLaunch( card, id,
                            sysAppLaunchFlagNewGlobals  | sysAppLaunchFlagNewStack,
                            cmd, cmdPBP, ret );
    }

    return err;
}


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to