Ronnen Belkind wrote:
> Can someone explain this code to me.
>
> params.title = MemHandleLock (DmGetResource (strRsc, titleStrID));
> /* ... */
> MemPtrUnlock (params.title);
>
> Why do they lock the handle, but unlock the pointer. Why not call
> MemHandleUnlock?
You can use either MemHandleUnlock or MemPtrUnlock, whichever is more
convenient. They accomplish the same thing. In this particular case,
the handle in question (returned by DmGetResource) is not being kept
around in any local variable, so there's no way to use MemHandleUnlock.
You _could_ keep the handle around in a local variable to pass to
MemHandleUnlock, but there's no point since MemPtrUnlock can be used
instead as shown. This is a common pattern you'll get used to.
-slj-