Hmm . . . I'm not sure this is it, but on first glance, this looks like a
buffer-overrun to me.  You may want to check the size of the handle you get
from the field on the second call to your function.  

I didn't code this up, but I'd check to make sure that if you find an
existing handle, that it is the size you think it is (in this case, 11).
Who knows, the OS may be manipulating the handle as part of the
FldSetTextHandle call (it may truncate the handle to the length of the
string + NULL, or something like that) so when you get the handle from the
field and then try to stuff a bigger number into it, you overflow the memory
handle, corrupt memory and get Very Bad Things.  Something like below would
probably do the trick and let you know if this is the problem.

Hope this helps . . .

-DGA

>       oldhand = FldGetTextHandle(fld);
> 
>       if (!(oldhand))         oldhand = MemHandleNew(11);
        else 
        if (MemHandleSize (oldhand) != 11)
        {
                MemHandleResize (oldHand, 11);
        }
>       fldptr = MemHandleLock(oldhand);
> 
>       StrIToA(fldptr, newtime);
> 
>       FldSetTextHandle(fld, oldhand);
>       FldDrawField(fld);
>       MemHandleUnlock(oldhand);

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