At 03:15 AM 1/20/2008, you wrote:
Subject: Re: Wrong result from MemHandleSize?
From: David Linker <[EMAIL PROTECTED]>
Date: Sun, 20 Jan 2008 00:00:06 -0800
X-Message-Number: 5

void showProblem() {
        MemHandle h;
        /*long int*/ UInt32 strsize;
        Char * loc;

        h = DmGet1Resource('tSTR', 2000);
        DisplayFatalErrorIf (!h, "Can't find #2000");
        strsize = MemHandleSize(h); //Yields incorrect value ~ 288628
        loc = (Char *)MemHandleLock(h);
        DisplayFatalErrorIf (!loc, "Can't lock #2000");
        strsize = 0;
        while (*loc != 0) strsize ++; loc++;} //Gives correct value of 3283
}

What you are doing should work and always works for other people.

I made some minor changes to the code above (for example: use UInt32 here instead of long int), especially since you have a long unsigned value not a long int anyway.

And you should ALWAYS put in code to trap unexpected but possible errors such as the resource not being found and not being able to lock it.

So the strong suspicion is the problem is your resource!


Roger Stringer
Marietta Systems, Inc. (www.rf-tp.com)


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

Reply via email to