Colleen,
Here's some source code we cobbled together to set alarms up on a Palm
device, maybe it'll give you some clues as to how to do things. When the
program starts it sets up an alarm that ought to fire 60 seconds after the
program was launched, and then it keeps setting up a following alarm that
goes off 120 seconds after that... HTH
static UInt32 PrvDaysSince1904(void)
{
DateType d;
DateSecondsToDate( TimGetSeconds(), &d);
return DateToDays(d);
}
static void PrvSetFixedAlarm(void)
{
LocalID LocID;
UInt16 cardNr;
UInt32 alarmSeconds;
SysCurAppDatabase(&cardNr, &LocID);
alarmSeconds = TimGetSeconds() + 60UL;
AlmSetAlarm(cardNr, LocID, 1, alarmSeconds, 0);
}
static void PrvHandleEventSysAppLaunchCmdAlarmTriggered(Ptr cmdPBP)
{
LocalID LocID;
UInt16 cardNr;
UInt32 alarmSeconds = 0;
SysAlarmTriggeredParamType * a = (SysAlarmTriggeredParamType *)cmdPBP;
SysCurAppDatabase(&cardNr, &LocID);
alarmSeconds = a->alarmSeconds + (120UL);
AlmSetAlarm(cardNr, LocID, a->ref, alarmSeconds, 0);
// ensure that the upcoming sysAppLaunchCmdDisplayAlarm launch *will*
happen
a->purgeAlarm = false;
}
UInt32 PilotMain( UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
{
//...
switch (cmd) {
case sysAppLaunchCmdNormalLaunch:
error = AppStart();
if (error)
return error;
PrvSetFixedAlarm();
FrmGotoForm(MainForm);
AppEventLoop();
AppStop();
break;
case sysAppLaunchCmdAlarmTriggered:
PrvHandleEventSysAppLaunchCmdAlarmTriggered(cmdPBP);
break;
case sysAppLaunchCmdDisplayAlarm:
//do what needs doing
break;
}
return errNone;
}
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/