CImage image; image.Load(_T("1.jpg")); //HBITMAP hBitmap=image.Detach(); HGLOBAL m_hMem = GlobalAlloc(GMEM_MOVEABLE, 0); IStream *pstm=NULL; CreateStreamOnHGlobal(m_hMem, TRUE, &pstm); image.Save(pstm,ImageFormatBMP); LARGE_INTEGER liBeggining = { 0 }; pstm->Seek(liBeggining, STREAM_SEEK_SET, NULL); DWORD size = GlobalSize(m_hMem); LPBYTE lpData = (LPBYTE)GlobalLock(m_hMem); CFile BMPfile(L"11.bmp",CFile::modeReadWrite | CFile::modeCreate); BMPfile.Write (lpData,size); BMPfile.Close(); pstm->Release(); GlobalUnlock(m_hMem);
http://bbs.csdn.net/topics/370241566