Hello All,

I have a button in my application, on click of that button I need to
display the data(FirstName, LastName) from address book.Is there
any method/approach to read the data from the native
databases(Address book, Date book etc). I have written the following code:

Err getAddressDatabase()
{
MemHandle mh;
UInt16 cardNo;
UInt16 recordNum;
UInt16 index;
short width = 10, height = 20;
LocalID dbID;
// const Char* nameP;

Err err;
DmSearchStateType searchState;
char* pText;
//AddressFields src;
MemPtr p;
//int z=0;
DmOpenRef dbvar;
// PrvAddrPackedDBRecord *src;

dbID = DmFindDatabase(sysFileCAddress,"AddressDB" ) ;

//DmDatabaseInfo(cardNo, dbID, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &appInfoID, NULL, NULL, NULL)
if (dbID == 0)
{

//WinDrawChars("hai11",StrLen("ha11i"),20,30);

err = DmGetNextDatabaseByTypeCreator(true, &searchState, addrDBType,sysFileCAddress, true, &cardNo, &dbID);

if(err !=0)
{
return DmGetLastErr();
}
else
{

// Open the address database.
dbvar = DmOpenDatabase(cardNo, dbID, dmModeReadOnly);
recordNum = DmNumRecords(dbvar);
// WinDrawChars (const Char *chars, Int16 &recordNum, Coord 20, Coord 30)

for(index=0;index<recordNum;index++)
{
// err = DmRecordInfo(dbvar,index,NULL,NULL,NULL);
mh = DmQueryRecord (dbvar,index);
//p= (char*)MemHandleLock(mh);
}

}

}
return err;
}



In the above, while I'm running in the Debug mode using CodeWarrior (8.0), I'm getting my pointer as NULL, I want to read the AddressBook records and display on the form.


Thanks in advance.

Srini


_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail


--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to