I just rewrite it using handles which I un/lock to get pointers which I use.
Now it all works!  I'd still appreciate some explaination as to why it was
giving me such a hard time.  The Palm OS Companion says MemHandles can be
expanded once unlocked whereas MemPtrs have a harder time when expanded.

I love the Palm OS Companion and Palm OS Reference PDFs!

P. S. POS Companion says MemPtrNew cannot be passed a zero-size while the
document makes no mention as to whether or not MemHandleNew can withstand a
zero-size call.  Anyone know about that or how I can test that using some
permutation of my first line?  Just a thought, not important.

Here's the fixed code if anyone with a similiar problem is interested:

<<<CODE>>>
 hStrings = MemHandleNew(1); // Just get a pointer and put a dummy size in
it

 for (stringCnt = topRecordInList; stringCnt < topRecordInList +
MAX_HIST_VIEWABLE_ITEMS; stringCnt++) {
  if ((hRecord = DmQueryRecord(gDB, stringCnt)) == NULL)
   break; // No more records to display
  // Lock down that patient's record so we can read from it without the Data
Manager moving it around on us
  pPatient = MemHandleLock(hRecord);

  pTempString = &pPatient->firstField + pPatient->offsetLastName;

  stringLength = StrLen(pTempString) + 1;

  MemHandleResize(hStrings, offset + stringLength);
  pStrings = MemHandleLock(hStrings);
  StrCopy(pStrings + offset, pTempString);
  *(pStrings + stringLength - 1) = '\0';
  MemHandleUnlock(hStrings);
  MemHandleUnlock(hRecord);
  offset += stringLength;
 }
<<<END>>>



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

Reply via email to