المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : how to display a bitmap which have 24 colors



C++ Programming
11-15-2009, 08:21 AM
hi,everyone recent i was study how to use ffmpeg to make a media player,but now i miss a question that how to show a bitmap on dc.


CRect rt;
GetClientRect(&rt);
CClientDC dc(this);
CDC mem;
mem.CreateCompatibleDC(&dc);
CBitmap bp;
bp.CreateBitmap(width,height,1,24,lpbits);
mem.SelectObject(&bp);
dc.StretchBlt(0,0,rt.Width(),rt.Height(),&mem,0,0,width,height,SRCCOPY);
but the code not work
lpbits is pointer to the data of bitmap,"height" is the height of bitmap "width" is the width of bitmap
and the size of one pixel's color is three byte

lpbits height width 24 is the all data we know about this bitmap
can you help me to show the data on DC