How can I display a JPG or GIF in my MFC app?
1) http://www.tek-tips.com/faqs.cfm?fid=1096
-----------------------------------------------------------
Paul DiLascia answered this question very nicely in his C++ Q&A column in the October 2001 issue of MSDN Magazine. You may find his article at http://msdn.microsoft.com/msdnmag/issues/01/10/c/c0110.asp Also, MFC 7.0 (in Visual C++ .NET) will include a CImage class that will let you do this. Please see http://msdn.microsoft.com/msdnnews/2001/sept/vcnet/vcnet.asp CodeGuru has some info as well. Here's a link on animated GIFs: http://www.codeguru.com/bitmap/PictureEx.html And here's one on TIFF files: http://www.codeguru.com/bitmap/tiff_image.html |
-----------------------------------------------------------
2) Add GIF-animation to your MFC and ATL projects with the help of CPictureEx and CPictureExWnd
http://www.codeproject.com/Articles/1427/Add-GIF-animation-to-your-MFC-and-ATL-projects-wit?display=PrintAll
貌似只能从文件加载需要显示的gif?
3)
An MFC picture control to dynamically show pictures in a dialog
http://www.codeproject.com/Articles/24969/An-MFC-picture-control-to-dynamically-show-picture?display=Print
支持多种加载方式:
//Loads an image from a file
BOOL LoadFromFile(CString &szFilePath);
//Loads an image from an IStream interface
BOOL LoadFromStream(IStream* piStream);
//Loads an image from a byte stream;
BOOL LoadFromStream(BYTE* pData, size_t nSize);
LoadFromStream 这个很适合从http下载一个gif验证码图片到buffer,然后进行显示的情况!^_^