blogger counters

Thursday, October 27, 2005

ListChanged in PocketOutlook on Windows Mobile 5.0

I've been working on a calendar application for the Pocket PC. Now that Windows Mobile 5.0 devices are shipping, I figured I should ensure my application works on Windows Mobile 5.0. There is one feature I added that doesn't work anymore--my application doesn't receive notification when the calendar changes. For previous versions of the Pocket PC, I was able to trap changes to the appropriate CEDB property database via some C++ code. However, Windows Mobile 5.0 uses a new, and incompatible, database to store PIM information, so my change hook from before doesn't work.

I was thus very excited to discover Microsoft had shipped a managed assembly for use on Windows Mobile 5.0 that supports receiving change notification. Their assembly, Microsoft.WindowsMobile.PocketOutlook has a number of classes that correspond with POOM (Pocket Outlook Object Model) objects. In particular, the PimItemCollection class contains an event called ListChanged. Perfect! Or so I thought.

Testing this code when changing or adding an appointment using the Calendar application didn't work. What gives? It turns out the ListChanged event doesn't receive change notifications from the operating system. Instead, it only tells you of changes made "to the collection." In other words, if your application uses the managed classes to modify, add, or remove an appointment, your application will be notified. If any other application changes the calendar (or any of the other supported databases), you do not receive notification. In other words, you can use the managed event to keep your application current with the data in the database. This is documented in the Wiki article Windows Mobile 5.0 Managed on Channel 9.

So, I'm back to adding C++ code that will support Windows Mobile 5.0.

Related Articles
What's New for Developers in Windows Mobile 5.0


Post a Comment

<< Home