Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create CBitmap from buffer

Status
Not open for further replies.

dima2

Programmer
Jan 20, 2002
85
LB
is there a way to create a CBitmap object form a buffer containing
data in bmp format?
 
Yep,

You can use the CreateBitmapIndirect() to do this. It takes a * to a BITMAP struct that contains the information about the bitmap.

HTH.
William
Software Engineer
ICQ No. 56047340
 
ya, you are going to want to read in the

BITMAPFILEHEADER bmf;
BITMAPINFOHEADER bmi;

and from those you can determine the size of the buffer for the acutal bitmap data

BYTE *bmpBits = new BYTE[bmi.biWidth*bmi.biHeight*bmi.biBitCount/8];

then read the rest of the buffer into that and that is your bitmap bits which the

BITMAP struct will want when you create indirect. Also, other members of BITMAP will need to be set.

Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top