I am struggling with the PhoneNumberLookup function.  I have a test
application that takes a string and updates a field on a form.  Then I call
the PhoneNumberLookup function with that field.  All that works fine.
However, when the PhoneNumberLookup function returns the address I select, I
receive a "MemoryMgr.c, Line:5253, Chunk under-locked" error.  I've reviewed
all the books I have on Palm computing and looked at the MemoPad SDK which
also uses the PhoneNumberLookup function and I can't find the answer.
Following is a snippet of the code I'm using.  As you'll notice I'm not
doing anything with the returned field currently.  Eventually, when I get
this working, I'm going to copy the information in the field to a string
(HiddenHiddenField is declared with a maximum length of 160):

 FormPtr   hiddenfrmP;
 FieldPtr  fieldP;
 MemHandle  textH;
 Char*   str;

// initialize "hidden" form and retrieve "hidden" field
   hiddenfrmP = FrmInitForm (HiddenForm);
   FrmDrawForm(hiddenfrmP);
   fieldP = (FieldPtr)FrmGetObjectPtr(hiddenfrmP,
FrmGetObjectIndex(hiddenfrmP, HiddenHiddenField));
   textH = FldGetTextHandle(fieldP);
   textH = MemHandleNew ( 5 );
   str = MemHandleLock(textH);
   StrCopy(str, "Test");
   MemHandleUnlock(textH);
   FldSetTextHandle(fieldP, textH);
   FldDrawField(fieldP);
   MemHandleFree(textH);

// perform lookup
   textH = FldGetTextHandle(fieldP);
   textH = MemHandleNew ( 161 );

   PhoneNumberLookup(fieldP);

   FldSetTextHandle(fieldP, textH);
   FldDrawField(fieldP);

// free handle to prevent memory leak
   StrIToA(result1P, FldGetTextLength(fieldP));
   MemHandleFree(textH);

   FrmDeleteForm(hiddenfrmP);

Thanks,
Dave



-- 
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