VoidHand and Handle are not interchangable, at least not if you are a GCC
user.  It's something I figured out the hard way.

Here is one example:

I get a compile error if I try the following:

{
   FieldPtr     pfld;
   //... some steps
   MemHandleFree (FldGetTextHandle (pfld));
}

// Explanation...
// GCC's field.h indicates FldGetTextHandle returns a handle.
// GCC's field.h indicates that MemHandleFree expects a VoidHand.

I have to explicitly cast, as in ...

{
   FieldPtr     pfld;
   //... some steps
   MemHandleFree ((VoidHand) FldGetTextHandle (pfld));
}

Seems like I mentioned this once before.  It was a great source of
frustration to me since I was new to C AND Palm OS.  I thought I would go
nuts trying to make my first program work until I figured this out (with the
help of this forum of course.)

Mitch

> -----Original Message-----
> From: Chris Antos [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, April 15, 1999 3:39 PM
> To:   [EMAIL PROTECTED]
> Subject:      Re: Is this legal?
> 
> it would be better to only make one call to DmGetResource (saves batteries
> and runs faster, by only searching for the resource once).
> 
> 
> BitmapPtr pbmp;
> VoidHand h;
> h = DmGetResource('Tbmp', 1300);
> pbmp = (BitmapPtr)MemHandleLock(h);
> WinDrawBitmap(pbmp, X, Y);
> MemHandleUnlock(h);
> 
> 
> 
> the types "Handle" and "VoidHand" are synonymous, in every case i know of.
> perhaps one of the Palm guys can comment on whether they are always
> synonymous or not.  i'm not sure why types exist.
> 

Reply via email to