Programming with the Contacts Database

Designing a Contacts database application involves calling the Contacts database application programming interface (API) functions to manipulate the database elements. In general, your Contacts database application will include the following processes:

You can use wrapper functions to map a user-defined setting to a system-defined one. For an application that tracks patient visits to a doctor, you can use the stBirthDate and stAnniversary properties to hold the time and dates of previous and future office visits. The following code example shows how to write a SetOfficeVisitDates function to set these two properties.

void SetOfficeVisitDates(SYSTEMTIME stVisit, BOOL fPrev, ADDRESSCARD * myAC)
{
   if(fPrev) 
         myAC.stBirthdate=stVisit;      // previous office visit
   else
         myAC.stAnniversary=stVisit;    // future office visit
}

Similarly, the following code example shows how to write a GetOfficeVisitDates to return the appropriate date for the office visit.

SYSTEMTIME GetofficeVisitDate(BOOL fPrev, ADDRESSCARD myAC)
{
   if(fPrev) 
        return myAC.stBirthdate;        // previous office visit
     else
        return myAC.stAnniversary;      //  future office visit
}