the safest would be to use BmpGetSizes to obtain size of header and size of data
so you will know how much you need to store. and as others wrote, you are
caching only (incomplete) header in your code, use BmpGetBits to get data
Ryan Rix wrote:
> Hey guys,
>
> I am writing code to dynamically draw icons for an application launcher.
> I am using a linked list to store all of the entries of the launcher,
> which include both tAIB resource bitmaps (which are just BitmapType
> written to a resource, right?) and generic BitmapTypes, all stored as
> pointers in my node structure as a BitmapPtr icon.
>
> When I attempt to copy the resource to a static location in memory using
>
> newLink->icon=MemPtrNew( sizeof(BitmapType));
> DmOpenRef ref=DmOpenDatabase(cn,id,dmModeReadWrite);
> MemHandle h = DmGetResource( 'tAIB', 1000 );
> if(h){
> BitmapPtr oldIcon = MemHandleLock(h);
> MemMove(newLink->icon, oldIcon, sizeof(BitmapType));
> MemHandleUnlock(h);
> }else{
> newLink->icon=NULL;
> }
> DmReleaseResource(h)
>
> I usually get crap written to the BitmapPtr and when I draw it with
> WinDrawBitmap I usually get either a crash or just crap drawn to the
> screen, I've yet to get a working icon.
> Does anyone have a clue why my code keeps crapping out like this?
>
> --
> Thanks and best regards,
> Ryan Rix
> TamsPalm - The PalmOS Blog
> (623)-239-1103 <-- Grand Central, baby!
>
> Jasmine Bowden - Class of 2009, Marc Rasmussen - Class of 2008, Erica
> Sheffey - Class of 2009, Rest in peace.
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/