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/

Reply via email to