hi,
in my application i 'm supposed to display list of
records from the selected local application/database
from palm device --
my approach is as follows ->
1) using DmNumDatabases() i got the total no of
database present.
2) then query and get the database id using
DmGetDatabase().
3) now passing that id and cardno(i'm putting zero
here) to the DmDatabaseInfo() i 'm getting the
necessary info of the database.
4)then once i got the required id comparing the
database name , i'm using DmOpenDatabase() to open
that and read the no of txt-records using
DmNumResources().
5) once i know th total no of records to display,
allocate required mem to the char pointer to hold the
name of the records
6) Query the database, lock record to handle and
determine txt length and store the record-name to
display.
upto this it's working fine -- now the problem is to
displaying the record-name --
here, i 'm using DmQueryRecord() to query the data
inside the database -- and using the '\n'
character i'm trying to get the record-name as follows
-
fileH = DmQueryRecord(ref_of_open_database,index) ;
if(fileH)
{
pSrc = MemHandleLock(fileH);
if(pSrc){
//Get the length of the records Name
recordNmLength = (UInt)(StrChr( pSrc, '\n')- pSrc);
StrNCopy(recordNm, pSrc, recordNmLength);
LocalFileName[k] =
(Char*)MemPtrNew(StrLen(recordNm));
MemSet(LocalrecordName[k],StrLen(recordNm),0);
MemMove(LocalrecordName[k++],recordNm,StrLen(recordNm));
MemSet(recordNm,StrLen(recordNm),0); //Reset mem
to reuse
MemHandleUnlock(fileH );
}
}
it's working fine with say "MemoPad" for example i'm
getting the 4 recordnames from it ie "Handheld
Basics","Four ways to enter text" etc. but it's
failing with other databases , say "AddressBook " or
"mailBox" -- there '\n' is not working actually --
it's giving the length as the total length of the
content , so it's coming around 60k or so and the char
pointer, pSrc to DB record, is showing blank--
How can i solve this problem ??
is it because every database or application can chose
its own way to store records and not all applications
give "titles" or "recordnames" at all to their
records??
if this is the case then what should be the approach
to display the recordnames of, say, addressBook or
mail Box(where i want to display name whose
address/mail is stored in the address/mail box??)
Thanx in Advance for any help ---
Pinaki
________________________________________________________________________
Yahoo! India Insurance Special: Be informed on the best policies, services, tools and
more.
Go to: http://in.insurance.yahoo.com/licspecial/index.html
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/