CBitmap

N

Newbie

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,&dcMem,0,0,SRCCOPY);

dcMem.SelectObject(pOld);
bitmap.DeleteObject();
dcMem.DeleteDC();
delete []bbits;
 
V

Victor Bazarov

Newbie said:
Hello everyone,
i'm new to windows programming in C++. I have to display a 2-D array [..]

Wrong newsgroup. Try 'comp.os.ms-windows.programmer.tools.mfc' or
'microsoft.public.vc.mfc'

V
 
J

Jim Langston

Victor Bazarov said:
Newbie said:
Hello everyone,
i'm new to windows programming in C++. I have to display a 2-D array [..]

Wrong newsgroup. Try 'comp.os.ms-windows.programmer.tools.mfc' or
'microsoft.public.vc.mfc'

V

or microsoft.public.vc.langauge
 
M

Mike Wahler

Jim Langston said:
Victor Bazarov said:
Newbie said:
Hello everyone,
i'm new to windows programming in C++. I have to display a 2-D array
[..]

Wrong newsgroup. Try 'comp.os.ms-windows.programmer.tools.mfc' or
'microsoft.public.vc.mfc'

V

or microsoft.public.vc.langauge

AFAIK, 'CBitmap' is an MFC type, so imo an MFC group
would be the best place to ask, as Victor says.

"Newbie":
You wrote: "compiler doesnt identify the CBitmap class"

Note that for types other than the built-in ones (i.e.
those from the standard library or third party libraries
such as MFC, you need to *tell* the compiler about them.
This is done with headers. Find out which header defines
the 'CBitmap' type, and #include it in your code. Again,
any further questions about this should be directed
to an MFC group.

-Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top