.........
////////加载图片文件到内存
CFile file;
if( !file.Open( m_pathname, CFile::modeRead) )
{
AfxMessageBox(_T("打开文件失败"));
return;
}
m_nFileLen = file.GetLength();
HGLOBAL hMem = ::GlobalAlloc( GMEM_MOVEABLE, m_nFileLen );//GlobalAlloc函数分配内存句柄
LPVOID lpBuf = ::GlobalLock( hMem );//锁定内存中指定的内存块
if( file.ReadHuge( lpBuf, m_nFileLen ) != m_nFileLen )
{
AfxMessageBox(_T("文件读取失败"));
return ;
}
file.Close();
char * m_pJPGBuffer;
IStream * pStream;
IPicture * pPicture;
m_pJPGBuffer = (char *)lpBuf;
::GlobalUnlock( hMem );//用 GlobalUnlock 函数将内存块解锁
CreateStreamOnHGlobal( hMem, TRUE, &pStream );//用全局内存初使化IStream接口指针
OleLoadPicture( pStream, m_nFileLen, TRUE, IID_IPicture, ( LPVOID * )&pPicture ); //用OleLoadPicture获得IPicture接口指针
................
如何将数据转为HBITMAP bitmap;我要用bitmap,请教~~