Hi!
I want access to the the contacts database. So what I do is open the database:
DmSearchStateType sIP;
UInt16 CardNo;
LocalId DBID;
DmGetNextDatabaseByTypeCreator(true, &sIP, 'DATA', 'addr', true,
&CardNo, &DBID);
void *DBp = DmOpenDatabase(CardNo, DBID, 0x0001); // read only
// I have 4 contacts in the database
// this returns 4, which it should.
DmNumRecordsInCategory(DBp, 0xFF); // 0xFF == all categories
// now I want to use DmQueryNextInCategory to loop through the
// records that are not deleted (and thus contain the contacts)
Uint16 Offset, index;
Offset = 0;
index = 0;
while(DmSeekRecordInCategory(DBp, &index, Offset, 1, 0xFF) == 0)
{
Offset = 1;
// get the record using the index here and do something with it
}
This loop is executed only twice i.s.o. 4 times.
The error returned by DmSeekRecordInCategory() when the loop is exited is
dmErrIndexOutOfRange, which is the error it should return when it can't find
anymore records in the category, right?
Any ideas?
Thanks,
Marco
Note: I am calling this from ARM using pace wrappers for the API calls. I'm
pretty sure that that is working ok.
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/