Hi Bob,

the calls are ok - I used the short form. I wrote the code bellow. No other
part of the program can see the window handle - hence it cannot be
unintentionally freed.

Does it mean you use a similar sequence and it works for you?

Jan



typedef struct tagProgressData
{
 WinHandle hSavedArea ;
 Boolean   bProgressShown ;
 Boolean   bAborted ;
}
ProgressData ;

#define INIT_PROGRESSDATA(p){ \
 (p)->bProgressShown = false ; \
 (p)->bAborted  = false ; \
 (p)->hSavedArea  = NULL  ; \
 }
static long ProgressFun( short percent, void* data )
{
 ProgressData *pd = (ProgressData*)data ;
 long ret = -1 ;        // -1 means abort
 if( percent == FnProgressFunStopMsg )
 {
  if( pd->hSavedArea != NULL )
  {
   WinRestoreBits( pd->hSavedArea, X1, Y1 ) ;
   pd->hSavedArea = NULL ;
  }
 }
 else
 if( !EvtEventAvail() )
 {
   RectangleType rect ;
   rect.topLeft.x = X1 ;
   rect.topLeft.y = Y1 ;
   rect.extent.y  = DY ;

   if( !pd->bProgressShown )
   {
    UInt16 err ;
    rect.extent.x = DX ;
    pd->hSavedArea = WinSaveBits( &rect, &err)  ;
    pd->bProgressShown = true ;
   }

   rect.extent.x = percent*DX/100 ;
   WinDrawRectangle( &rect, 0 ) ;
    ret = 1 ;
 }
 else
  pd->bAborted = true ;
 return ret ;
}


----- Original Message -----
From: "Robert Moynihan" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Tuesday, May 25, 2004 8:34 PM
Subject: Re: Window68K.c, Line:92, No shadow window found


> Jan, are you really calling WinSaveBits() -- ie. with empty arguments?
> The prototype (that I use) is
>
>     WinHandle WinSaveBits(const RectangleType *source, UInt16 *error)
>
> Presuming that you are calling the function correctly, are you
> inadvertently freeing the handle ("handle") at some point so that the
> WinRestoreBits(handle,x,y) command can not find it?
>
> Bob.
>
> Jan Slodicka wrote:
>
> >Hello,
> >
> >does anybody know what this means?
> >
> >I want to do a progress and for that sake I am drawing a rectangle and
> >filling it. First step is
> >handle=WinSaveBits()
> >and the last step calls WinRestoreBits(handle).
> >
> >Progress is used inside a callback called from an app started via
> >SysAppLaunch().
> >
> >The whole thing works under M68K and to an extent under ARM - i.e. until
> >WinRestoreBits() is called, which results in a fatal alert written in the
> >email subject. If I remove WinRestoreBits, then everything works - except
> >bad drawing effect.
> >
> >Regards,
> >    Jan Slodicka
> >
> >
> >
> >
> >
> >
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/


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

Reply via email to