Hy,
I currently use an alarm to trigger my application and my code looks like this:
 switch (cmd)
    {
    case sysAppLaunchCmdNormalLaunch:    
      err=StartApplication();
        if (err) 
           return err;
        FrmGotoForm(MainForm);
        AppEventLoop();
         AppStop();
         break;
        case sysAppLaunchCmdSystemReset:
        case sysAppLaunchCmdSyncNotify:
            RegisterForNotifications1 ();
            break;
        case sysAppLaunchCmdNotify:
            HandleNotification ((SysNotifyParamType *) cmdPBP);
            break;
case sysAppLaunchCmdDisplayAlarm:
    if (!( launchFlags & sysAppLaunchFlagNewGlobals)) 
//=> here is the problem! I want at this point to know if my application is 
running or not. If it's not running then I will launch it with a 
sysAppLaunchCmdNormalLaunch command, and if this' running then I want to set 
the alarm at 5 seconds so I can let the user finish his job.
{
SysCurAppDatabase(&cardNo,&dbID);
// reallocating memory for the autoupdate! afte 10 seconds
alarmMe = (AlarmPtr) MemPtrNew (sizeof (AlarmType));
err = AlmSetAlarm(cardNo,dbID,(UInt32)alarmMe,TimGetSeconds()+10,true);
MemPtrSetOwner (alarmMe, 0);
SysUIAppSwitch (cardNo, dbID, sysAppLaunchCmdNormalLaunch,NULL);
//-> here I wanted to set a custom launch code, but aparently nobody pointed me 
to the right docs :-(
}
else
 { 
// if the application is running then allocate a new alarm after 5 sec
SysCurAppDatabase(&cardNo,&dbID);
alarmMe = (AlarmPtr) MemPtrNew (sizeof (AlarmType));
err = AlmSetAlarm(cardNo,dbID,(UInt32)alarmMe,TimGetSeconds()+5,true);
if (err)
ErrAlert(err);
MemPtrSetOwner(alarmMe,0);
}                                       
return errNone;                 
}

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

Reply via email to