MemLocalIDToLockedPtr on a handle amounts to MemHandleLock
and MemHandleSize amounts to MemPtrSize of the pointer the handle
points to, so this code should produce the same results. That being
said, this is weird...i have used MemHandleSize on resources on NVFS
and it always returned the right size for me.

On 1/19/08, Jan Slodicka <[EMAIL PROTECTED]> wrote:
> Hi David,
>
> a small auto-advertizing :-)
>
> Use Resco Explorer, go to RAM folder, "view" your DB and find particular
> record. You will see the size in the upper left corner.
>
> However, the method to get this number differs from yours:
>
> LocalID  blockID;
> We use DmResourceInfo to get blockID and then
>   void* ptr = MemLocalIDToLockedPtr(blockID, 0) ;
>   long recSize = MemPtrSize(ptr) ;
>
> Not that this would be any better, but at least you have an independent
> check with a working software.
>
> With best regards,
>     Jan Slodicka
>     Resco, Palm Division
>
>
> ----- Original Message -----
> From: "David Linker" <[EMAIL PROTECTED]>
> To: "Palm Developer Forum" <[email protected]>
> Sent: Saturday, January 19, 2008 6:33 PM
> Subject: Re: Wrong result from MemHandleSize?
>
>
> > The handle is allocated, and I can even search for the end of the
> > string and get the right value for the length!
> >
> > I was originally planning to resize the string resource as I modified
> > it, but I can't do that if I don't know the correct length. I suppose
> > I could just be careful never to make it longer, and leave the chunk
> > the same size. I had hoped for a more elegant solution.
> >
> > Any ideas?
> >
> >
> > Code example:
> > h = DmGet1Resource('tSTR', myString);
> >          strsize = MemHandleSize(h);
> > // strsize = 288628, which is much too big
> >          loc = MemHandleLock(h);
> >          strsize = StrLen(loc);
> > //strsize = 288628 again wrong, but at least it is consistent!
> >          loc = source;
> >          while (*loc != 0) {i++; loc++;}
> > // i=3283  this is the correct value
> >
> > On Jan 18, 2008, at 6:38 PM, Jeff Loucks wrote:
> >
> > > Check the handle returned by DmGet1Resource(). Don't use it if it's 0.
> > > MemHandleSize(0) acts differently on my several devices and
> > > simulators/emulators. For example, 700p returns 0, while the
> > > simulator (T-C this time) crashed. I don't have my 680 near by to
> > > test, but it may return 290K.
> > > On Jan 17, 2008 10:59 PM, David Linker <[EMAIL PROTECTED]>
> > > wrote:
> > > I want to modify a string resource, but have trouble finding the
> > > correct size.
> > >
> > > I know that it is about 3200 bytes long, but get over 290K as strsize
> > > from the following code!
> > >
> > > Any suggestions welcome.
> > >
> > > I am using pilrc to compile the resources, SKD 5, and gcc.
> > >
> > > // myString is a resource about 3800 bytes long
> > > h = DmGet1Resource('tSTR', myString);
> > > strsize = MemHandleSize(h);
> > >
> > >
> >
> >
> > --
> > For information on using the ACCESS Developer Forums, or to unsubscribe,
> please see http://www.access-company.com/developers/forums/
>
>
> --
> For information on using the ACCESS Developer Forums, or to unsubscribe, 
> please see http://www.access-company.com/developers/forums/
>


-- 
Best Regards,
Dmitry Grinberg
(847) 226 9295

-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to