Menu

More on IPicture (loading jpg, bmp, etc)

2002-12-19
2012-09-26
  • Nobody/Anonymous

    For those interested:

    I downloaded the loadpic.exe off of the microsoft knowledge base (after doing a search for it), and after several changes got it to work :)  It compiles to 41k for a basic image viewer.

    Steps involved:
    0) go to microsoft.com, do a search under the knowledge base for loadpic.exe and download the C++ example

    1) File/New/Project - empty project

    2) Add loadpic.cpp to project

    3) At the top should be changed/added:

    // LoadPic.cpp : Defines the entry point for the application.
    //
    #include <windows.h>
    #include <unknwn.h>
    #include <objidl.h>
    #include <oleauto.h>
    #include <olectlid.h>
    #include <olectl.h>
    #include <ole2.h>
    #include "stdafx.h"
    #include "resource.h"

    #define MAX_LOADSTRING    100
    #define HIMETRIC_INCH    2540
    #define MAP_LOGHIM_TO_PIX(x,ppli)   ( ((ppli)*(x) + HIMETRIC_INCH/2) / HIMETRIC_INCH )

    4) Project/Project Options/Compiler:
    -fvtable-thunks

    5) Project/Project Options/Linker Options:
    -lole32 -loleaut32 -luuid -lolepro32

    6) Comment out //#include <crtdbg.h>  in stdafx.h

    7) Comment out the _ASSERTE.. in loadpic.cpp
    (trying to figure out what that does like error checking? and its usage, at the moment getting compiler errors with it in.)

    7A)     in the ATOM MyRegisterClass() in loadpic.cpp, change the LoadIcon() to this:
    wcex.hIconSm = LoadIcon(NULL, IDI_APPLICATION);

    8) Rebuild All/Run

    9) Enjoy, you may need to make some small additional changes, let me know if this floats ur boat, or if u have already done this and i am treading water.

    - drarem

     
    • Nobody/Anonymous

      ohh.. you need to do  Project/Add Resource File and click on the loadpic.rc.

      - drarem

       
    • Nobody/Anonymous

      added the -s compiler option and wound up with 13k :)

      - drarem

       
    • Nobody/Anonymous

      I use Dev 4.9.70 with the new GCC and it didn't work for me. But I got it running just the same:
      1. Simply import the VC project file (.dsp).
      2. keep only the TWO .cpp files in the project.
      3. Make the changes you described, but skip the compiler and linker settings.

      that's it.

      JS

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.