At 10:10 AM 4/5/2004, you wrote:

hello forum,

I want to draw someting to a certain area of the screen. When I use the
following steps, I have a sys0502 error. Does anybody know what it means?

1. draw a pic using "paint" program of windows, which will be shown on the
screen.
2. in Pilrc, create a bitmap, assign the pic to this bitmap
3. then I try to draw something:

MemHandle hMousePad;
BitmapType *pMousePad;
MemHandle win;

hMousePad = DmGetResource('Tbmp',MousePad); //MousePad is the image

if(hMousePad!= NULL)
{
        pMousePad=(BitmapPtr)MemHandleLock(hMousePad);
        win=WinCreateBitmapWindow(pMousePad,&error);
        if (error) ErrAlert(error);
        WinSetDrawWindow(win);
        ...
        ...
}

You can't draw into a bitmap window from a resource, since the resource is in write-protected memory. You should instead make an offscreen window of the same size, then do a WinDrawBitmap into that window from the bitmap resource. A bitmap window is useful to get to bitmap data copied off the screen, but you just can't make one for read-only data like you're attempting.



-- Ben Combee, senior DTS engineer, PalmSource, Inc. Read "Combee on Palm OS" at http://palmos.combee.net/



--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to