473,395 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

CBitmap

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;

Feb 2 '06 #1
4 7507

Newbie wrote:
Hello everyone,
i'm new to windows programming in C++.


This group discusses standard C++.

http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

<Windows / MFC code snipped>

You might find microsoft.public.vc.mfc more useful.

Gavin Deane

Feb 2 '06 #2
Newbie wrote:
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
Feb 2 '06 #3

"Victor Bazarov" <v.********@comAcast.net> wrote in message
news:Pl***************@newsread1.mlpsca01.us.to.ve rio.net...
Newbie wrote:
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
Feb 3 '06 #4
"Jim Langston" <ta*******@rocketmail.com> wrote in message
news:hS***************@fe03.lga...

"Victor Bazarov" <v.********@comAcast.net> wrote in message
news:Pl***************@newsread1.mlpsca01.us.to.ve rio.net...
Newbie wrote:
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
Feb 3 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: mark | last post by:
I want to use CBitmapButton. This class knows the function LoadBitmaps to set a bitmap in a button. The problem is that LoadBitmaps is asking for a Resource ID. I have loaded the bmp file in...
2
by: Amir | last post by:
Hey, I'm working on an IE toolbar and I need to load a CBitmap from a bitmap file's internet address. I get the URL of the image from a mySQL lookup, but is there a way I can load the CBitmap with...
2
by: Jimmy Lu | last post by:
I use CBitmap::CreateBitmap create a CBitmap object, and sets the bit datas by CBitmap::SetBitmapBits, but I can not display it on the screen(ie. use CDC::BitBlt). Thanks in advance. My codes...
2
by: Netian | last post by:
Hello , Please teach me how to create an Icon object with multiple images by GDI++ . I can create an Icon with a image as following , but can't do an Icon with multiple images. private Icon...
1
by: Jigar Mehta | last post by:
Hye friends!! Jigar Mehta from India. Currently I am loading one BMP file around 2.5 MB from the disk from my VC program and show it to its DC... But while CBitmap object tries to load it by...
4
by: Marco Segurini | last post by:
Hi, I am trying to avoid flicker in this situation: 1) I create a simple VB6 Window application (a void form) and I define this code for the form (that has the autoredraw property set to...
2
by: Geky | last post by:
If I load a Bitmap from a file and I have Cbitmap and HBITMAP how is possible to use GetBitmapBits and SetBitmapBits to modify the image inside the memory? BITMAP m_Bitmap; // Struct to hold...
6
by: InNeedOfHelp | last post by:
I am writing an application using MFC and was wanting to include a function similar to the select function available in Paint. I want to allow the user to grab the screen and drag it where they want...
0
by: kenneth6 | last post by:
I am preparing a dialog-based MFC application. I want to show the CBitmap object created after processing on the windows dialog. Should I show it to DC or the picture control?? Which one is practical...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.