void LoadMemImage( void * pMemData, long len) { HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, len); void * pData = GlobalLock(hGlobal); memcpy(pData, pMemData, len); GlobalUnlock(hGlobal); IStream * pStream = NULL; if (CreateStreamOnHGlobal(hGlobal, TRUE, & pStream) == S_OK) { CImage image; if (SUCCEEDED(image.Load(pStream))) { // .. } pStream -> Release(); } GlobalFree(hGlobal); }