Hello everyone,
i'm new to windows programming in C++. I have to display a 2-D array as
a bitmap. I tried to compile the following code..but the compiler
doesnt identify the CBitmap class...can anyone tell me what is missing
(headers/functions) so as to complete the code??
HDC dc= ::GetDC(0);
int Bps = ::GetDeviceCaps(dc,BITSPIXEL);
::ReleaseDC(0,dc);
int size = 100*100*Bps/8;
BYTE *bbits = new BYTE[size]; //-------------bbits is a 2D(100*100)
array
memset(bbits,192,size);
CBitmap bitmap;
bitmap.CreateBitmap(100, 100, 1, Bps, bbits);
BITMAP bmp;
bitmap.GetBitmap(&bmp);
CClientDC dcScreen(this);
CDC dcMem;
dcMem.CreateCompatibleDC(&dcScreen);
CBitmap *pOld = dcMem.SelectObject(&bitmap);
dcScreen.BitBlt(0,0,bmp.bmWidth,bmp.bmHeight,&dcMe m,0,0,SRCCOPY);
dcMem.SelectObject(pOld);
bitmap.DeleteObject();
dcMem.DeleteDC();
delete []bbits;