Source

Save CBitmap to File

It has always astounded me why the CBitmap class never implemented saving to a file.  Here’s a nice and tidy way:

#include

#include

        //…

        CBitmap bitmap;

        bitmap.CreateBitmap(width, height, 1, 32, rgbData);

        CImage image;

        image.Attach(bitmap);

        image.Save(_T(“C: est.bmp”), Gdiplus::ImageFormatBMP);

with : , ,