What you need here is a notification handler... heres some exaple code
static Err
NotificationHandleEvent ( SysNotifyParamType *notify, UInt32 *refP )
{
Err error = 0;
switch ( notify->notifyType )
{
case sysNotifySleepRequestEvent:
/* CODE */
break;
case sysNotifyLateWakeupEvent:
/* CODE */
break;
}
return error;
}
UInt32
PilotMain ( UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags )
{
UInt16 error = 0;
UInt32 ref;
switch ( cmd )
{
case sysAppLaunchCmdNormalLaunch:
/* CODE */
break;
case sysAppLaunchCmdNotify:
NotificationHandleEvent ( (SysNotifyParamType *)cmdPBP, &ref );
break;
}
return 0;
}
hope this helps.
Philip Streck
Akron General Medical Center
Information Systems
>>> Ralph Krausse <[EMAIL PROTECTED]> 05/30/01 12:51PM >>>
Hello all.
I need to have my application be notified EVERYTIME a HotSync is
completed. So, per the manual, I am trying to register
sysNotifySyncFinishEvent. I have put the source below. ExecutedHotSync()
just writes out a file so I know the HotSync completed. I also put some
sound in so I can hear when events are called. It seems that
SysNotifyRegister() gets called because I hear the sound. But then I do a
hotsync but I don't get my second sound, i.e., I am not getting
sysNotifySyncFinishEvent event. Where should I be doing my
SysNotifyRegister(). Is this correct? Can anyone help. Is this close or way
off?
static UInt32 StarterPalmMain(UInt16 cmd, MemPtr /*cmdPBP*/, UInt16
launchFlags)
{
.....
.....
.....
switch (cmd)
{
case sysNotifySyncFinishEvent:
for(int i = 0; i < 15; i++)
{
SndPlaySystemSound(sndError);
SysTaskDelay(15);
}
ExecutedHotSync();
break;
case sysAppLaunchCmdNormalLaunch:
LocalID lID = 0;
UInt16 uiCard = 0;
SysCurAppDatabase(&uiCard,&lID);
if(lID)
{
for(int i = 0; i < 15; i++)
{
SndPlaySystemSound(sndError);
SysTaskDelay(1);
}
SysNotifyRegister(0, lID,
sysNotifySyncFinishEvent , NULL, sysNotifyNormalPriority, NULL);
}
error = AppStart();
if (error)
return error;
FrmGotoForm(MainForm);
AppEventLoop();
AppStop();
break;
default:
break;
}
Ralph Krausse
Expo International, Inc.
110 Shawmut Road
Canton, MA 02021
telephone (781) 821-6653
www.expo-intl.com
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/