CPaintDC dc(this); 
IPicture *pPic;
IStream *pStm;
CFileStatus fstatus;
CFile file;
LONG cb;
if (file.Open("d:\\test.jpg",CFile::modeRead)&&file.GetStatus  ("d:\\test.jpg",fstatus)&& ((cb = fstatus.m_size) != -1))
{
HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, cb);
LPVOID pvData = NULL;
if (hGlobal != NULL)
{
if ((pvData = GlobalLock(hGlobal)) != NULL)
{
file.ReadHuge(pvData, cb);
GlobalUnlock(hGlobal);
CreateStreamOnHGlobal(hGlobal, TRUE, &pStm);
if(SUCCEEDED(OleLoadPicture(pStm,fstatus.m_size,TRUE,IID_IPicture,(LPVOID*)&pPic)))
{
OLE_XSIZE_HIMETRIC hmWidth;
OLE_YSIZE_HIMETRIC hmHeight;
pPic->get_Width(&hmWidth);
pPic->get_Height(&hmHeight);
double fX,fY;
fX = (double)dc.GetDeviceCaps(HORZRES)*(double)hmWidth/((double)dc.GetDeviceCaps(HORZSIZE)*100.0);
fY = (double)dc.GetDeviceCaps(VERTRES)*(double)hmHeight/((double)dc.GetDeviceCaps(VERTSIZE)*100.0);
if(FAILED(pPic->Render(dc,0,0,DWORD(fX*2),DWORD(fY*2),0,hmHeight,hmWidth,-hmHeight,NULL)))
AfxMessageBox("Failed To Render The picture!");
pPic->Release();
}
else
AfxMessageBox("Error Loading Picture From Stream!");
}
}
}
else
AfxMessageBox("Can't Open Image File!");
}
别忘了用AfxOleInit()初始化。

解决方案 »

  1.   

    如果允许用ActiveX的话,用DirectX Media中的DirectAnimation最方便了。
    看看msdn,两分钟就做好了。
      

  2.   

    http://www.ijg.org/ 一个非常好用的jpeg库,很多软件都是用它处理jpeg的,比如
    ACDSee. 包里有详细的使用说明.
      

  3.   

    去http://www.vchelp.net/source/submit/imagexye.htm看一看。
      

  4.   

    你可以使用intel的一个库,可能就在kaede说的那有,如果找不到我可以发给你。