Wasn't this discussed a little while ago?  Anywho...

> Can anybody help me?

RTFM.  The polite version of this acronym means Read The Manual.  Using 
notifications you can ask to be notified of any number of things, including 
system power up.

Use this code, or something very similar to it:

// In my pilot main
    case sysAppLaunchCmdSystemReset:
    case sysAppLaunchCmdSyncNotify:
      if (RomVersionCompatible ( ourFeatureVersion, launchFlags ) == errNone)
        RegisterForNotifications();
      break;

    case sysAppLaunchCmdNotify:
      HandleNotification ( (SysNotifyParamType *)cmdPBP );
      break;



// The code that registers for notifications
static void RegisterForNotifications( void ) {
  UInt16 cardNo;
  LocalID dbID;

  if (SysCurAppDatabase(&cardNo, &dbID) != errNone)
    return; // shouldn't ever fail, but just in case.

  SysNotifyRegister ( cardNo, dbID, sysNotifySleepRequestEvent, NULL,
                      sysNotifyNormalPriority, 0);
}

Replace sysNotifySleepRequestEvent with whatever event you want to trap.  This 
is much better than writing a system extension (read: hack) and is preferred.

// The function that handles the notifications
static void HandleNotification(SysNotifyParamType *np) {
  switch ( np->notifyType ) {
    case sysNotifySleepRequestEvent:
      // do stuff
      break;
    default:
      // do nothing
      break;
  }
}

I usually load up my preferences at the top.  Enjoy!

-- 
Matthew (Darkstorm) Bevan       [EMAIL PROTECTED]
Margin Software, NECTI.         http://www.marginsoftware.com
        Re-inventing the wheel, every time.

 - What is mind?  No matter.
   What is matter?  Never mind.
                -- Thomas Hewitt Key, 1799-1875


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

Reply via email to