I'm trying to retrieve the contacts from my phone using C++ and the 3.0 SDK. Below is an excerpt of my code. An exception occurs when I make any call on the contact created by calling GetContact(). I've excluded the COM specific code.

IPhonebook3 * phoneValue3;
// This works.
hr = phoneValue3->GetMemoryCaps(PHYS_MEM_PHONE, LOG_MEM_PD, &maxNumberOfEntries, &fullNumberOfEntries, &fractionOfEntriesFree);
long location = 0;
_bstr_t emptyString = _bstr_t(""
currentContact = phoneValue3->GetContact(MODE_FIRST, KEY_LOCATION, PHYS_MEM_PHONE, LOG_MEME_PD, &location, emptyString);

// Now any call on the contact object fails...For example,
long numberOfFields = currentContact->GetAmountOfFields();

Do I need to make a COM call for the currentContact object, perhaps initializing it? If you can't provide a specific solution, any info on how to best debug this problem would be appreciated. I am new to the VC++ environment.