How to load graphics files and display them in Visual C++

Article translations Article translations
Article ID: 218972 - View products that this article applies to.
This article was previously published under Q218972
Expand all | Collapse all

On This Page

Note 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 INFORMATION

Visual C++ 6.0

The following file is available for download from the Microsoft Download Center:
Collapse this imageExpand this image
Download
Download the Loadpic.exe package now.
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 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++ .NET

The following file is available for download from the Microsoft Download Center:
Collapse this imageExpand this image
Download
Download the Loadpicvcnet.exe package now.
Release Date: June 25, 2002

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 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.

Properties

Article ID: 218972 - Last Review: May 22, 2008 - Revision: 8.0
APPLIES TO
  • Microsoft Visual C++ 2005 Express Edition
  • Microsoft Visual C++ .NET 2003 Standard Edition
  • Microsoft Visual C++ .NET 2002 Standard Edition
  • Microsoft Visual C++ 6.0 Professional Edition
  • Microsoft Visual C++ 6.0 Enterprise Edition
  • Microsoft Visual C++, 32-bit Learning Edition 6.0
  • Microsoft Win32 Application Programming Interface
  • Microsoft Visual C++ 2008 Express Edition
Keywords: 
kbsweptvs2008 kbfunctions kbinfo kbdownload kbfile kbgdi kbhowto KB218972

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com