Share via


Generating Notifications (Windows Embedded CE 6.0)

1/6/2010

To generate notifications, Windows Embedded CE facilitates communication between the base notification engine and your notification UI. When an event occurs, the base notification engine creates a NotifyPacket structure in RAM containing notification parameters in the sPacket member. It then passes a handle to this structure to your notification UI through the CeNotifyPublic_NewPacket function. Your notification UI is then responsible for handling the notification.

To handle a notification with your notification UI

  1. Examine the NotifyPacket structure.

    This step requires your notification UI to lock the notification database with the CeNotifyPrivate_Lock function.

  2. Obtain a pointer to the structure by calling the CeNotifyPrivate_TranslateOID function.

    If this function returns NULL, the notification has been handled and the request to dismiss the UI has already been dispatched.

  3. Present the requested UI functionality.

    For example, launch a dialog box, play a sound, or launch the appropriate application if no UI is required for the notification.

  4. Unlock the notification database by calling the CeNotifyPrivate_Unlock function.

    If your notification UI creates a dialog box, set GWL_USERDATA to M_WORD to correctly dispatch dialog box messages. The notification subsystem uses the value defined by M_WORD to clearly identify its windows and message-related processing.

For a sample implementation of this procedure, see the CeNotifyPublic_NewPacket function in %_WINCEROOT%\Public\Common\Oak\Notify\Notifext.cxx.

You should not maintain or use the NotifyPacket structure while the notification database is unlocked. Use a notification handle instead, and translate it to a NotifyPacket structure when locking the database. While the notification database is locked, the base notification engine is not functional. Consequently, do not lock the database for extended periods of time.

If a user issues a request to postpone a notification, your notification UI can reschedule the notification with the CeNotifyPrivate_Reschedule function. Once a notification is handled, your notification UI should call the CeNotifyPrivate_DeleteNotification function, which causes the base notification engine to delete the database record and remove the NotifyPacket structure from the list of active notifications. CeNotifyPrivate_DeleteNotification will not free the structure itself, but will return it to the notification UI through the CeNotifyPublic_DisposeOfPacket function. The notification UI should then dismiss any UI functionality that is associated with the notification and free the pointer to the NotifyPacket structure with the LocalFree function.

For an example of how to clear notification responses, see the CeNotifyPublic_DisposeOfPacket function in %_WINCEROOT%\Public\Common\Oak\Notify\Notifext.cxx.

See Also

Concepts

Implementing Notifications