BOOL MBmpToMImage(CMemFile& cbfBmp, CMemFile& cbfImage, CString strType) { int iBmpSize = cbfBmp.GetLength(); HGLOBAL hMemBmp = GlobalAlloc(GMEM_FIXED, iBmpSize); if (hMemBmp == NULL) return FALSE; IStream* pStmBmp = NULL; CreateStreamOnHGlobal(hMemBmp, FALSE, &pStmBmp); if (pStmBmp == NULL) { GlobalFree(hMemBmp); return FALSE; } BYTE* pbyBmp = (BYTE *)GlobalLock(hMemBmp); cbfBmp.SeekToBegin(); cbfBmp.Read(pbyBmp, iBmpSize); Image* imImage = NULL; imImage = Image::FromStream(pStmBmp, FALSE); if (imImage == NULL) { GlobalUnlock(hMemBmp); |