I'm having trouble figuring out how to return a handle or pointer from a 
function.  Is the only alternative to make all such handles global?  The 
function below attempts to return a local handle. This seems to work but may be 
causing some of my crashes later in the program.  Can someone help a poor 
newbie.
Thanks,
Jim

MemHandle getFieldText(UInt16 fieldID)
{
        FieldType*              fldP;
        MemHandle               h;
        char*                   fieldTextP;

        fldP=getObjectPtr(fieldID);     //get a pointer to the field
        h = FldGetTextHandle(fldP);
        if(h)
        {
                fieldTextP = MemHandleLock(h);  // prevent the chunk from 
moving (lock) and obtain pointer to location
                if(fieldTextP)
                        MemHandleResize(h, StrLen(fieldTextP)+1);
                MemHandleUnlock(h);
        }
return h;
-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to