Article ID: 218972 - Last Review: May 22, 2008 - Revision: 8.0 How to load graphics files and display them in Visual C++This article was previously published under Q218972 On This PageNote Microsoft Visual C++ 2008, Microsoft Visual C++ 2005, Microsoft Visual C++ 2003, and Microsoft Visual C++ .NET 2002 support both the managed code
model that is provided by the Microsoft .NET Framework and the unmanaged native
Microsoft Windows code model. The information in this article applies only to
unmanaged Visual C++ code. SUMMARY Loadpic.exe is a sample that shows how to load graphics
files like .gif, .jpg, .bmp, .ico, .emf, .wmf, and displays them. To do this,
use functionality built into the OleLoadPicture function. The OleLoadPicture function converts these different
formats to an IPicture interface. We can then use the IPicture::Render function to display
them. MORE INFORMATIONVisual C++ 6.0The following file is available for download from the Microsoft Download Center:Collapse this image ![]() 119591
(http://support.microsoft.com/kb/119591/
)
How to obtain Microsoft support files from online services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help prevent any unauthorized changes to the file.
Visual C++ .NETThe following file is available for download from the Microsoft Download Center:Collapse this image ![]() For more information about how to download Microsoft support files, click the following article number to view the article in the Microsoft Knowledge Base: 119591
(http://support.microsoft.com/kb/119591/
)
How to obtain Microsoft support files from online services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help prevent any unauthorized changes to the file.
Aside from the IPicture::Render function, you can also display the picture using other functions. You can use the BitBlt function for bitmaps, or the PlayMetaFile function for metafiles. You can also extract the handle to the picture by calling the IPicture::get_Handle function. You can cast the handle to the appropriate type; that is, for example HBITMAP, HICON, and HMETAFILE. To determine what type of handle to cast it to, call the IPicture::get_Type function. APPLIES TO
| Article Translations
|

Back to the top

