Virtual Developer Workshop: Containerized Development with Docker


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.

  • (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.)


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


Download Source Code - 153 KB


  • software

    Posted by Donna Wayne on 03/28/2017 03:18pm

    That's a pretty nice software, but many times it bugs. I usually use this: http://www.paintshoppro.com/en/pages/wmf-file/ and open WMF files with PaintShop pro. I find it to be the easiest if I need a bit of editing

  • Does not support .jpg file created in CMYK color mode

    Posted by Priya_Sundar on 05/22/2008 11:54am

    I am not able to open a .jpg file, which in a CMYK color mode. How to provide support for such files?

  • Pixel

    Posted by Legacy on 01/17/2004 08:00am

    Originally posted by: bassem

    your work is great, i hope you all the success
    can 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 07:00am

    Originally posted by: Edmond Chui

    It really helps me to learn how to display GIF in Windows application.

  • How to load and display bitmap files on a dialog box by MFC

    Posted by Legacy on 01/21/2003 08:00am

    Originally 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


    • Display a bitmap on dialog box

      Posted by lavanya_thanneru on 01/19/2006 12:40pm

      I know how to display the bmp file on dialog box .But i have never displayed it on a static control.If u want to display a bmp on a static control then use Create() method of a CStatic  object this way...
      CStatic st;
      //Code to display the bmp
      //szFileName is the name of bmp file
         CBitmap bmp;
         CClientDC dc(this);
         CDC bmDC;
         CBitmap *pOldbmp = bmDC.SelectObject(&bmp);
         BITMAP  bi;

  • help me!

    Posted by Legacy on 01/14/2003 08:00am

    Originally posted by: zhscx

    Can yon provide the recourse code of "*.img" format for me .
    Thank you very much!

  • a simple image viewer

    Posted by Legacy on 01/11/2003 08:00am

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

  • Hard to get it runnung but wooha

    Posted by Legacy on 12/03/2002 08:00am

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

  • A very simple way to fix to the assertion failure under win98

    Posted by Legacy on 11/14/2002 08:00am

    Originally 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 !

  • VB-it's cool thing to do!

    Posted by Legacy on 10/14/2002 07:00am

    Originally posted by: spe@ker

    Hi from Russia!

  • Loading, Please Wait ...

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date