Contacts, a Windows CE personal information manager (PIM) application, is organized as a series of records, called address cards. Each address card contains a number of fields, called properties. Among the many predefined properties are name, address, telephone number, birthday, and anniversary. The Contacts database application is bundled with Windows CE and includes a graphical user interface.
Contacts can be used as is if the default application settings meet the needs of the user. However, you can take advantage of the open application programming interface and design new Contacts database applications. For example, you can design a Contacts database application to track a doctor's patient-contact information, including dates of previous and future office visits. You can retrieve, store, and query the records and properties in the Contacts database.
Since the Contacts database application is built on the Windows CE object store, you need to be familiar with the object store to completely understand the database. For more information about the object store, see Accessing Persistent Storage.
A Contacts database includes the following basic elements.
An address card stores information about one individual. The information is parsed into a set of predetermined properties. Each address card is represented by an AddressCard structure. The number of address cards in a Contacts database depends on the amount of available memory on the hardware device. To determine the number of records in the database, call the GetNumberOfAddressCards function.
A typical operation performed against an address card requires identification of the record and specification of its location in the database. To accomplish this, Windows CE assigns each address card a unique object identifier and a position index value. If you know the object identifier for an address card, you can get its position index by calling the GetAddressCardIndex function. Conversely, by calling GetAddressCardOid and passing in the position index as a variable, you can get the object identifier.
A property has an associated identifier called a property tag that is unique within the context of a single address card. To manipulate a property, you set the property tag with a call to the SetMask function. For example, you set the HHPR_HOME_TELEPHONE_NUMBER property tag to enable the home telephone number property of an address card. When accessing a property, you use the GetPropertyDataStruct function to specify whether the information should be retrieved by the position index, property name, or property tag. The information is then passed into a PropertyDataStruct structure.
Sort order specifies how the records are indexed. For example, records can be sorted according to the names or telephone numbers of the individuals. You can use up to four properties as the position indexes for sorting. However, you can sort only one property at a time. You specify an array of sort order options when you create a new database using CreateAddressBook and you specify a sort order out of the options list when you open an existing database using OpenAddressBook. You can change and retrieve the sort-order properties using the SetColumnProperties or GetColumnProperties function. In addition, you can change or retrieve the current sort order in an opened database using the SetSortOrder or GetSortOrder function.