Click here to Skip to main content
Click here to Skip to main content

An Image (GIF, JPEG, BMP, ICO, WMF and EMF) Viewer

By , 25 Oct 2002
 

ImgViewer

Introduction

This sample is an MFC application using the document/view architecture that can load, display and print graphics files such as GIF, JPEG, BMP (bitmap), ICO (icon), WMF (metafile) and EMF (Win32-enhanced metafile). It shows

  • how to use the OleLoadPicturePath() function and the IPicture interface to load and display those graphics files.

  • (Look into the ImgViewerDoc.cpp, ImgViewerView.cpp and MainFrm.cpp files.)
  • how to support more than one file extension per MFC document type.

  • (Look into the MulExtDocTmp.cpp, MulExtDocTmp.h and ImgViewer.cpp files.)

References:

Please see the following article in the Microsoft Knowledge Base:

Q218972 How To Load and Display Graphics Files w/LOADPIC.EXE
(Note that LOADPIC.EXE does not handle palettes. As a result, it won't display a 256-color image correctly in 256-color mode. Also, it uses the OleLoadPicture() function instead of the OleLoadPicturePath() function.)

Q141921 HOWTO: How to Support Two File Extensions per MFC Document Type
Q198538 DocMgrEx.exe Assoc Multiple File Extensions w/1 Doc Type

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Chen Su
Software Developer
Canada Canada
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 5membermanoj kumar choubey26 Feb '12 - 20:57 
Nice
QuestionMultipage EMF viewermemberLoris Rinaldo10 Nov '11 - 4:22 
I'm dealing with what I think is a multipage EMF file. Does your viewer handle this type of files?
If so would it be possible for you to send me the compiled version?
 
thanks
Loris
AnswerRe: Multipage EMF viewermemberChen Su10 Nov '11 - 15:14 
I am not sure. It depends on whether IPicture supports multipage EMF files. The EXE is already included in the ZIP file. You can give it a try.
GeneralRe: Multipage EMF viewermemberLoris Rinaldo18 Nov '11 - 10:19 
Thanks, I've tried.
 
The bad news is it only views the first page ... no sign of the rest.
 
The good news is that I found this other piece of software that does the job perfectly:
http://www.lvbprint.de/html/splviewer1.html
 

thanks for you time,
Loris
 
PS why do you write "Download source" when there also is the compiled exe version? Wouldn't "Download source and binary" be better?
GeneralLINK : fatal error LNK1104: cannot open file "uafxcwd.lib"memberBee cute3 Mar '11 - 3:26 
When I rebuild all I have a error
 
"LINK : fatal error LNK1104: cannot open file "uafxcwd.lib""
 

Plz help me to solve that problem !!!
 
If u have a simple project to load image JPG, PLZ post to help me.
 
I do not know how to load image JPG.
 
I have been finding for many days ago but I am not unsuccessful.
 
Regard !!!
 
Thanks 4 all !!!!
AnswerRe: LINK : fatal error LNK1104: cannot open file "uafxcwd.lib"memberAlbert Holguin19 Apr '11 - 7:13 
search your system for the library location, then make sure the linker has a path to the library location identified in the "library default locations" studio options
Generalcontactmemberlihuai26 Jan '10 - 22:30 
Hello. Be able to do with you by e-mail?
My e-mail:ljlwyy213@sina.com
GeneralImage disappearmembermazhar_cse15 Mar '07 - 23:09 
I can load bitmap image in Dialog or Sdi document. But if another window overlap my imageviewer, image is disappeared.
 
How can i solve the problem.
GeneralRe: Image disappearmemberChen Su16 Mar '07 - 8:40 
You need to put your drawing code in OnPaint().
GeneralImage disappearmembermazhar_cse15 Mar '07 - 23:08 
I can load bitmap image in Dialog or Sdi document. But if another window overlap my imgeviewer, image is disappeared.
 
How can i solve the problem.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 26 Oct 2002
Article Copyright 2002 by Chen Su
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid