Microsoft KB Archive/218972

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

Article ID: 218972

Article Last Modified on 1/7/2006

-

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++ 6.0 Standard Edition
 * Microsoft Win32 Application Programming Interface

-



This article was previously published under Q218972



Note Microsoft Visual C++ 2005 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.



Visual C++ 6.0
The following file is available for download from the Microsoft Download Center:

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:

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.

Additional query words: bitmap bitmaps jpeg gif89 icons icon enhanced metafile meta file loadpic loadpicvcnet

Keywords: kbhowto kbinfo kbdownload kbfile kbgdi kbfunctions KB218972

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.