Answered by:
Does Visual C++ 6.0 support CImage class?

Question
-
I am trying to save a CBitMap into a file. It was recommended that I use CImage to do so. But I can't get the code to compile
I am trying to do something like this:
#include <atlimage.h>
#include <Gdiplusimaging.h>
CBitmap bitmap;
bitmap.CreateBitmap(width, height, 1, 32, rgbData);
CImage image;
image.Attach(bitmap);
image.Save(_T("C:\\test.bmp" ), Gdiplus::ImageFormatBMP);
but it couldn't be compliled.
What do I have to do?
So if I can't use CImage, is there an equivalent class to use that is supported by C++ 6.0 version?
- Edited by WestRace Friday, May 22, 2009 12:49 AM
Friday, May 22, 2009 12:37 AM
Answers
-
CImage is not supported in VC6. For bitmaps, you can use OleCreatePictureIndirect or OleLoadPictureEx.
- Marked as answer by Wesley Yao Thursday, May 28, 2009 2:55 AM
Friday, May 22, 2009 2:26 AM -
You can also use GDI+ classes directly. The CImage class is just a wrapper class around GDI+.
MSMVP VC++- Marked as answer by Wesley Yao Thursday, May 28, 2009 2:55 AM
Friday, May 22, 2009 2:49 AM -
Hello WestRace,
- I'm afraid that CImage and atlimage.h doesn't exists in vc6.
- But you can use GdiPlus to save bitmap to disk and GdiPlus is the part of Windows SDK.
- Create a Bitmap object by using function - Bitmap::FromHBITMAP()
- Now you can use Image::Save() to save it to file.
- Check this article .
Regards,
Jijo.
http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.- Marked as answer by Wesley Yao Thursday, May 28, 2009 2:55 AM
Friday, May 22, 2009 3:24 AM
All replies
-
CImage is not supported in VC6. For bitmaps, you can use OleCreatePictureIndirect or OleLoadPictureEx.
- Marked as answer by Wesley Yao Thursday, May 28, 2009 2:55 AM
Friday, May 22, 2009 2:26 AM -
You can also use GDI+ classes directly. The CImage class is just a wrapper class around GDI+.
MSMVP VC++- Marked as answer by Wesley Yao Thursday, May 28, 2009 2:55 AM
Friday, May 22, 2009 2:49 AM -
Hello WestRace,
- I'm afraid that CImage and atlimage.h doesn't exists in vc6.
- But you can use GdiPlus to save bitmap to disk and GdiPlus is the part of Windows SDK.
- Create a Bitmap object by using function - Bitmap::FromHBITMAP()
- Now you can use Image::Save() to save it to file.
- Check this article .
Regards,
Jijo.
http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.- Marked as answer by Wesley Yao Thursday, May 28, 2009 2:55 AM
Friday, May 22, 2009 3:24 AM -
I'm not sure Sheng Jiang or Jijo Raj are correct. The last Windows SDK that the is compatible with VC6 is from February 2003. You will have to see if GDI+ is supported in this version of the SDK.
Perhaps another suggestion (in case it's not obvious) is to upgrade from VC6. Remember, Visual Studio 2008 Express is at a price point that's hard to resist.Friday, May 22, 2009 4:43 AM -
Thanks to everyone for their responses.Friday, May 22, 2009 5:00 AM
-
GDI+ was introduced to the Platform SDK around 2001 I think.
MSMVP VC++Friday, May 22, 2009 2:24 PM -
Yeah, I remember using GDI+ on VC6. Faintly.
Hans Passant.Friday, May 22, 2009 5:59 PM -
Hi all..
I using VC++ 6.0 too..
trying to include <Gdiplus.h> but get error like below after I compiled..
fatal error C1083: Cannot open include file: 'Gdiplus.h': No such file or directory
Anything I miss out..??
Please help..
Thank you..
shizu..
Friday, July 29, 2011 1:21 AM -
You missed a platform SDK upgrade..
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVPFriday, July 29, 2011 1:36 AM