Click to See Complete Forum and Search --> : GlobalAllocated memory pointer changing??


cxm7284
June 2nd, 1999, 06:10 PM
Hi gurus,

In win 32 bit, when i allocate memory using GLobalAlloc with moveable flag is set.
Does the pointer return by GlobalLock stay the same each time the GlobalLock is called, or will it change when the memory has been moved?

Thanks

June 3rd, 1999, 01:34 AM
Plan on it changing...because the moment you assume it doesnt, it will! Thinking out loud here (i.e., I didn't bother to look it up) I'd be willing to bet that if the Heap Manager ever compacts the heap--or moves your block--the address returned by GlobalLock() WILL change. Either way, I wouldn't keep copies of a locked pointer around once I unlocked it...that's just begging for a GPF.

Cheers!
Humble Programmer
,,,^..^,,,