An Image (GIF, JPEG, BMP, ICO, WMF and EMF) Viewer
Environment: Visual C++ 6.0 with Service Pack 3, Windows 9x, Windows NT 4.0 with Service Pack 6a and Windows 2000
This sample is an MFC application using the document/view architecture that can load, display, and print graphics files such aske 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.
- how to support more than one file extension per MFC document type.
(Look into the ImgViewerDoc.cpp, ImgViewerView.cpp, and MainFrm.cpp files.)
(Look into the MulExtDocTmp.cpp, MulExtDocTmp.h, and ImgViewer.cpp files.)
References:
Please see the following articles in the Microsoft Knowledge Base:
Q218972How 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.)
Q141921HOWTO: How to Support Two File Extensions per MFC Document Type
Q198538DocMgrEx.exe Assoc Multiple File Extensions w/1 Doc Type

Comments
Does not support .jpg file created in CMYK color mode
Posted by Priya_Sundar on 05/22/2008 04:54amI am not able to open a .jpg file, which in a CMYK color mode. How to provide support for such files?
ReplyPixel
Posted by Legacy on 01/17/2004 12:00amOriginally posted by: bassem
your work is great, i hope you all the success
Replycan you help me please in converting an image to a matrix?
have you any ideas about image watermarking? i need to insert some Data in an image..
thanks a lot in advance, and good day Mr
Great Example
Posted by Legacy on 09/24/2003 12:00amOriginally posted by: Edmond Chui
It really helps me to learn how to display GIF in Windows application.
ReplyHow to load and display bitmap files on a dialog box by MFC
Posted by Legacy on 01/21/2003 12:00amOriginally posted by: Raymond Lai
Dear Sir,
I want to make a little program that can show all the bitmaps in a specific directory, like a photo browsing software.
But i don't know how to do it. I just know how to open a file dialog box to choose the folder only. I don't know how to display a bitmap file on a static control(Frame control).
and i don't know how to create it dainamically, as i don't know there are how many pictures in the folder.
Can you send me the project and teach me how to do so?
Thanks alot !!
Have a nice day
Raymond
-
Reply
ReplyDisplay a bitmap on dialog box
Posted by lavanya_thanneru on 01/19/2006 04:40amhelp me!
Posted by Legacy on 01/14/2003 12:00amOriginally posted by: zhscx
Can yon provide the recourse code of "*.img" format for me .
ReplyThank you very much!
a simple image viewer
Posted by Legacy on 01/11/2003 12:00amOriginally posted by: abhinav tripathi
its cool but can you tell how to do the same in straight c/c++ code (non mfc)so it would be suitable for me...
ReplyHard to get it runnung but wooha
Posted by Legacy on 12/03/2002 12:00amOriginally posted by: OMEGASquad
Great program, you need to copy all these requested *.lib Files from the installation CD into the /LIB directory on your hraddrive, but when it's done you've got a real nice working program, good work boys...
Reply
A very simple way to fix to the assertion failure under win98
Posted by Legacy on 11/14/2002 12:00amOriginally posted by: Francis Leca
First i would to thank warmly Chen Su for his great code.
It is very easy to get rid of the assertion failure when compiling the project under win98.
Just change the project settings from Win32 Unicode Debug to Win32 Debug.
That's all !
ReplyVB-it's cool thing to do!
Posted by Legacy on 10/14/2002 12:00amOriginally posted by: spe@ker
Hi from Russia!
Reply
Can't open file "mfc42ud.lib"
Posted by Legacy on 10/07/2002 12:00amOriginally posted by: Grace
I encounter this error during linking, it says "Fatal error link LNK1104: Can't open file mfc42ud.lib"
ReplyI have resolve this problem already, i just re install my Visual Studio and include all the tools.
Loading, Please Wait ...