In the example above the persistent notification will only be sent if the device is being cradled (value of 1). Being able to specify a condition brings about increased flexibility when working with state notifications. If you are developing using the .NET Compact Framework, then equivalent functionality can be found in the Microsoft.WindowsMobile.Status namespace. This is just a small sample of the broker API set. For more information, please refer to the SDK documentation:
State and Notifications Broker
Managed Pocket Outlook Object Model
Prior to Windows Mobile 5.0 access to PIM functionality required native C++ programming because no interface classes were provided for Managed code to call. This was partly due to the lack of COM support in Compact Framework 1.0. With Compact Framework 2.0 COM interoperability is available through runtime generated proxy classes so developers can access COM objects directly if required. Additionally a new managed code library is available with Windows Mobile 5.0 that provides access to all PIM functionality from both Compact Framework 1.0 and 2.0 applications. This new functionality can be found within the Microsoft.WindowsMobile.PocketOutlook namespace and provides a streamlined object model that makes working with the PIM elements a lot easier. An example of using this new functionality to add a contact is shown below
using Microsoft.WindowsMobile.PocketOutlook;
.
.
.
using(OutlookSession outlookSession = new OutlookSession())
{
Contact contact = new Contact();
contact.FirstName = ?Joe?;
contact.LastName = ?Bloggs?;
contact.MobileTelephoneNumber = ?+00 (0) 123 456 7890?;
outlookSession.Contacts.Items.Add( contact );
}
It is clear from the above code that the new model is extremely concise and readable
Pocket PC Soft-keys
On Windows Mobile 5.0 Pocket PC devices, you will find the addition of two hardware keys in similar positions to those that exist on the Smartphone today. These keys, called soft-keys, are designed to relate to menu items immediately above the keys bringing a consistent look and feel across both Pocket PC and Smartphone platforms. Pocket PC applications can now lay out their menu structure to take advantage of these keys and provide quicker access to application functionality for the user.
Figure 1. Pocket PC Soft-keys and new menu structure
To enable your application to support the soft-keys, you need to use the SHCreateMenuBar API providing it a flag value of SHCMBF_HMENU.
cbi.dwFlags = SHCMBF_HMENU;
cbi.nToolBarId = IDM_MYMENU;
SHCreateMenuBar(&cbi);
The menu itself is a standard menu resource that can be edited using the Visual Studio 2005 Beta 2 resource editor. Individual soft-keys can be enabled or disabled using the SHEnableSoftkey API.
Contact picker
Windows Mobile 5.0 exposes the built-in contact selection user interface for use by applications, saving a lot of development time if all you want to do is to select a contact from the device?s contact database. It will display the standard window when invoked using the ChooseContact API. The following code snippet demonstrates use of this feature.
IPOutlookApp2 pApp;
IItem *pItem;
CHOOSECONTACT cc = {0};
cc.cbSize = sizeof (cc);
cc.dwFlags = CCF_CHOOSECONTACTONLY;
cc.hwndOwner = NULL;
ChooseContact (&cc);
pApp->GetItemFromOidEx(cc.oidContactID, 0, &pItem);