• 10
• 10
• 12
• 12
• 14

Opening Bitmaps in MFC

This topic is 3407 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I'm making a game in C++, and I need to open a bitmap in MFC (I'm using VC++ 2008). I have to perform a few color transformations on the image before I can display it, so I need to store the image in an array. I'm sure there's a simple command to do this, but I've been searching and can't seem to find one. Could anyone help?

Share on other sites
There's a class called CImage. It makes it very easy to open images and have them as arrays.

The code is as follows:

CString Cfilename( filename.c_str() ); // Convert from filename to CStringCImage openedCImage;if( openedCImage.Load( Cfilename ) != S_OK ){ throw( std::string("Error") ); }