#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);
CBitmap bitmap;
HANDLE handle = ::LoadImage( AfxGetInstanceHandle(),
lpszFileName,
IMAGE_BITMAP,
0, 0,
LR_LOADMAP3DCOLORS | LR_LOADFROMFILE );
if ( !handle ) // There were some problems during loading the image
return FALSE;
bitmap.Attach( (HBITMAP)handle );