load image using library ...

Hi Experts,

    I am trying to load some jpeg files using some library. I tried the following code, it is compiled fine, however, I saw no images ? Does anyone know what I might have missed ??? many thanks !!!

#include <vcl.h>
#include <iostream.h>

#include "EColor.h"
#include "EImage.h"

#pragma hdrstop

#pragma argsused
int main(int argc, char* argv[])
    EImageC24 EC24Image1;  // EImageC24 class instance
    enum IMAGE_FILE_TYPES eFileFormat;   // File type for load and save of images
    EColorLookup EColorLookup1;  // EColorLookup class instance
    EImageC24 EC24Image2;  // EImageC24 class instance
    EColorLookup EColorLookup2;  // EColorLookup class instance
    EImageBW8 EBW8Image3;  // EImageBW8 class instance
    EImageC24 EC24Image4;  // EImageC24 class instance
    EColorLookup EColorLookup3;  // EColorLookup class instance

//  This section contains the operations code
// Load BGA Substrate Color.jpg image into EC24Image1
    eFileFormat = EC24Image1.Load("C:\\Program   Files\\Euresys\\eVision\\Images\\EasyColor\\BGA Substrate Color.jpg");
// Load BGA Substrate Color.jpg image into EC24Image2
eFileFormat = EC24Image2.Load("C:\\Program Files\\Euresys\\eVision\\Images\\EasyColor\\BGA Substrate Color.jpg");
    EBW8Image3.SetSize(512, 512);
// Load BGA Substrate Color.jpg image into EC24Image4
eFileFormat = EC24Image4.Load("C:\\Program Files\\Euresys\\eVision\\Images\\EasyColor\\BGA Substrate Color.jpg");

        cout << " Test " << endl ;
         getchar() ;
        return 0;
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Without knowing the specific library you are using it is hard to know what you are supposed to be doing exactly.  However seeing that this is a console application (I think) I am guessing that just calling .LoadImage() is simply loading the image file into memory and is not physically displaying it, you will need to call a separate member function for EImageC24 in order to actually display the image on the screen.

*** Insert Google search here ***

I am guessing that you are using the eVision C++ library.  There is a separate draw function that is required to be called (as far as I can tell from a quick look) in order to display the image.  The function also needs to be passed in a window handle of the window that will display the image.  In order to pass in a Windows handle, you will need to start a Windows application rather than a simple console application which I think you may be using at the moment
meow00Author Commented:
Thanks very much ! What you guess is close to what I need to do.
So could you please give me some suggestions :
What kind of application should I use ? frame ? or form ? or just use :
File -> New -> Application ???

many thanks !!!

File | New | Application from within C++ Builder will give you a base for a Windows application / project and will also present you with a main form on which you can place your image.

If using a TForm to display the image, you will not need to use the eVision library (if tat is what you are using) unless you need the funcionality that it provides.  If you are just simply trying to display an image on a TForm:

Create a new project (File | New | Application)
Add a TImage component to the form within the IDE at design time and double click the added TImage component to allow you to load an image for display.
Once the image has been selected and loaded, you can set the AutoSize property of the Image component to be true so that the whole image can be viewed.

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

meow00Author Commented:
Thanks very much ! I do need some functions from eVision library in the future .....

so ... could you please where the "TImage" locates ? I couldn't find it at all :-(

many thanks !
If you need functions from the eVision library then you may not be able to use TImage class and retain functionality of the eVision library.

To use the EImageC24 class, you can call the Draw function and simply pass in the device context of the window control where you wish to draw the image.

Within the TForm, you can possibly do something like:


and see what happens.  I have never used C++ Builder to draw directly to a device context so am not sure what the results will be if drawing directly to the DC of the TForm.  You may need to add a TFrame to the main TForm and then draw to the frame's DC instead.

(from within the TForm's OnShow event or similar)


NOTE: This code may not work as I am not using the eVision library and have not used DC's directly as mentioned above.  But then again - it just might work.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
meow00Author Commented:
Thanks very much .... I will work on it  ^^
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.