Click here to Skip to main content
11,412,578 members (73,274 online)
Click here to Skip to main content

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

, 25 Oct 2002
Rate this:
Please Sign up or sign in to vote.
A sample that can load, display, and print graphics files.

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

Share

About the Author

Chen Su
Software Developer
Canada Canada
No Biography provided

Comments and Discussions

 
GeneralMy vote of 5 Pin
manoj kumar choubey at 26-Feb-12 21:57
membermanoj kumar choubey26-Feb-12 21:57 
QuestionMultipage EMF viewer Pin
Loris Rinaldo at 10-Nov-11 5:22
memberLoris Rinaldo10-Nov-11 5:22 
AnswerRe: Multipage EMF viewer Pin
Chen Su at 10-Nov-11 16:14
memberChen Su10-Nov-11 16:14 
GeneralRe: Multipage EMF viewer Pin
Loris Rinaldo at 18-Nov-11 11:19
memberLoris Rinaldo18-Nov-11 11:19 
GeneralLINK : fatal error LNK1104: cannot open file "uafxcwd.lib" Pin
Bee cute at 3-Mar-11 4:26
memberBee cute3-Mar-11 4:26 
AnswerRe: LINK : fatal error LNK1104: cannot open file "uafxcwd.lib" Pin
Albert Holguin at 19-Apr-11 8:13
memberAlbert Holguin19-Apr-11 8:13 
Generalcontact Pin
lihuai at 26-Jan-10 23:30
memberlihuai26-Jan-10 23:30 
GeneralImage disappear Pin
mazhar_cse at 16-Mar-07 0:09
membermazhar_cse16-Mar-07 0:09 
GeneralRe: Image disappear Pin
Chen Su at 16-Mar-07 9:40
memberChen Su16-Mar-07 9:40 
GeneralImage disappear Pin
mazhar_cse at 16-Mar-07 0:08
membermazhar_cse16-Mar-07 0:08 
Generalplease help me make program contrast bmp Pin
HoangManh at 4-Jun-06 18:45
memberHoangManh4-Jun-06 18:45 
GeneralHot to print Images Pin
gonetil at 6-Apr-05 6:43
membergonetil6-Apr-05 6:43 
GeneralRe: Hot to print Images Pin
Chen Su at 6-Apr-05 17:17
memberChen Su6-Apr-05 17:17 
GeneralRotate a picture Pin
Alex Evans at 3-Jan-05 17:35
memberAlex Evans3-Jan-05 17:35 
GeneralIPicutre data Pin
kowal at 19-Oct-04 7:55
memberkowal19-Oct-04 7:55 
Generalplease help me correct this Pin
ipichet at 13-Apr-04 23:41
memberipichet13-Apr-04 23:41 
Generalmake a 2-d graphics editor for window Pin
anurag somani at 10-Apr-04 1:39
memberanurag somani10-Apr-04 1:39 
GeneralDialog instead of Document ... Pin
Anonymous at 12-Jan-04 23:36
sussAnonymous12-Jan-04 23:36 
GeneralRe: Dialog instead of Document ... Pin
Chen Su at 13-Jan-04 9:18
memberChen Su13-Jan-04 9:18 
GeneralBug in the Program Pin
siquin at 4-Oct-03 17:55
membersiquin4-Oct-03 17:55 
GeneralRe: Bug in the Program Pin
Chen Su at 4-Oct-03 19:42
memberChen Su4-Oct-03 19:42 
GeneralRe: Bug in the Program Pin
tico_tech at 6-Oct-03 11:23
membertico_tech6-Oct-03 11:23 
QuestionHow 2 Save The Loaded File and then reload when required Pin
Vikrant Vikrant at 17-Jul-03 3:41
memberVikrant Vikrant17-Jul-03 3:41 
Can someone suggest how 2 Save the Image Loaded in a format which can be reloaded whenever required.
I do not wish to copy the original file ,if i have all the image data in my program.
Generalhelp me Pin
Anonymous at 5-Nov-02 15:53
sussAnonymous5-Nov-02 15:53 
GeneralRe: help me Pin
Christian Graus at 5-Nov-02 16:10
memberChristian Graus5-Nov-02 16:10 
GeneralRe: help me Pin
Anonymous at 5-Nov-02 16:24
sussAnonymous5-Nov-02 16:24 
GeneralRe: help me Pin
Christian Graus at 5-Nov-02 16:33
memberChristian Graus5-Nov-02 16:33 
GeneralRe: help me Pin
Anonymous at 18-Dec-07 6:39
sussAnonymous18-Dec-07 6:39 
Generalcan't load BMP Pin
xipeng at 31-Oct-02 21:48
sussxipeng31-Oct-02 21:48 
GeneralRe: can't load BMP Pin
Christian Graus at 31-Oct-02 22:31
memberChristian Graus31-Oct-02 22:31 
GeneralRe: can't load BMP Pin
Anonymous at 1-Nov-02 0:46
sussAnonymous1-Nov-02 0:46 
GeneralRe: can't load BMP Pin
Christian Graus at 1-Nov-02 1:40
memberChristian Graus1-Nov-02 1:40 
GeneralRe: can't load BMP Pin
Anonymous at 1-Nov-02 2:30
sussAnonymous1-Nov-02 2:30 
GeneralRe: can't load BMP Pin
Christian Graus at 1-Nov-02 7:34
memberChristian Graus1-Nov-02 7:34 
GeneralRe: can't load BMP Pin
Chen Su at 1-Nov-02 7:50
memberChen Su1-Nov-02 7:50 
GeneralRe: can't load BMP Pin
Anonymous at 1-Nov-02 18:25
sussAnonymous1-Nov-02 18:25 
GeneralRe: can't load BMP Pin
Chen Su at 1-Nov-02 19:53
memberChen Su1-Nov-02 19:53 
GeneralRe: can't load BMP Pin
Anonymous at 2-Nov-02 5:30
memberAnonymous2-Nov-02 5:30 
GeneralRe: can't load BMP Pin
Chen Su at 2-Nov-02 13:22
memberChen Su2-Nov-02 13:22 
Generalerror Pin
Anonymous at 31-Oct-02 16:35
sussAnonymous31-Oct-02 16:35 
GeneralRe: error Pin
Christian Graus at 31-Oct-02 16:42
memberChristian Graus31-Oct-02 16:42 
GeneralRe: error Pin
Chen Su at 31-Oct-02 16:55
memberChen Su31-Oct-02 16:55 
GeneralAt least! Pin
Daniel Turini at 26-Oct-02 22:46
memberDaniel Turini26-Oct-02 22:46 
Generalthis is poor Pin
Mr. Pickles at 26-Oct-02 20:13
memberMr. Pickles26-Oct-02 20:13 
GeneralRe: this is poor Pin
Shog9 at 26-Oct-02 20:11
memberShog926-Oct-02 20:11 
GeneralRe: this is poor Pin
Black Cat at 27-Oct-02 4:04
memberBlack Cat27-Oct-02 4:04 

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

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