Um... you shouldn't use MemHandleResize on Data chunks. Try DmResizeRecord.
I know the underlying OS DOES call MemHandleResize from DmResizeRecord, but
it does some OS stuff first. Plus, if the MemHandleResize fails, then the
DM tries to allocate a new DmHandle in another heap. If you just use
MemHandleResize, your chance of failure it higher since it won't reallocate
in another heap. In addition, it's a little pointless to resize a chunk
gotten by DmQueryRecord since you shouldn't be writing to a chunk you get
with DmQueryRecord, as then you could have multiple things writing to a
record at the same time. And if you're not writing, why would you need to
resize?
Alan Pinstein
Synergy Solutions, Inc.
http://www.synsolutions.com
1-800-210-5293
>Hi all,
>
>I'm getting MemHandleResize returning memErrorNotEnoughSpace (257)
>for some records in my database.
>
> I've got the following piece of code basically it is copied from
>ExpenseChangeRecord in ExpDB.c (from the Expense program)
>
>recordH = DmQueryRecord (dbP, *index);
>src = MemHandleLock (recordH);
>.....
>calculate new size
>.....
>MemPtrUnlock (src);
>err = MemHandleResize (recordH, newsize);
>if (err) showerror ("Resize failed", "", err);
>
>Now for some records I get err=257. The interesting thing is
>that it will happen to one record (which is no bigger than the others)
>but work fine for the others, I come back to the bad record and it
>still returns 257 on attempting to resize?????
>
>Resetting the device clears this problem and I can resize the record.
> Is it possible the record is locked somehow? The documentation states
>that a locked record will return memErrChunkLocked
>
>I get the problem on PalmOS 3.0 and 2.0.4.
>
>I really need some pointers on this I've had the problem for about 3 months.
>
>Thanks,
>Hamish