load an image (using a library) to a form ...

Hi experts,

   This is a follow up question of :
 http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus_Builder/Q_21219873.html

   Now I am trying to load an image using some library (Yes, I need to use some functions of the library later ...). The following code compiled but I see no image ......
 
  Here is the Draw function :
 void Draw(HDC hDC, FLOAT32 f32ZoomX = 1.f, FLOAT32 f32ZoomY = 0.f) ;

  Therefore, how do I modify line00 ? or how to add any device context in the following code  in order to solve the problem ??? Please help ! many thanks !!!

meow.
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"

#include "EColor.h"  //EasyColor Header
#include "EImage.h"  //EasyImage Header

//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
   EImageC24 EC24Image1;

   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

   EC24Image1.Draw(this->GetDeviceContext);  // line00 .............

  //  This section contains the operations code
   ESetJpegQuality(90);
   // 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);
   EBW8Image3.SetSize(&EC24Image2);
// Load BGA Substrate Color.jpg image into EC24Image4
eFileFormat = EC24Image4.Load("C:\\Program Files\\Euresys\\eVision\\Images\\EasyColor\\BGA Substrate Color.jpg");

}
//---------------------------------------------------------------------------
LVL 1
meow00Asked:
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.

WoodsterCommented:
Try using the HDC of the Canvas property within the TForm.

EC24Image1.Draw(this->Canvas->Handle);
0
WoodsterCommented:
That line above will pass in the device context of the TForm.Canvas which is what the TForm component uses to draw itself on.  Let me know if you have more luck with that.
0
meow00Author Commented:
Thanks a lot .... but why I got the following errors by replacing line00 with the above line ??? please help. thanks !

[Linker Error] Unresolved external 'EImage<EC24>::Draw(void *, float, float)' referenced from C:\DOCUMENTS AND SETTINGS\TEST\UNIT1.OBJ
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

WoodsterCommented:
A linker error such as that means that the function EImage<EC24>::Draw(void *, float, float) has not been found in the list of .lib / .obj files that are being linked in to the executable.  If the application was successfully compiling and linking previously when you had the previous call to draw in then it should still link now.

You may need to check the library documentation and make sure you have included any required .lib or .obj files in your project so that they can be linked at compile time.

Try this and see if it compiles and links

HDC deviceContext = this->Canvas->Handle;
EC24Image1.Draw(this->Canvas->Handle);
0
meow00Author Commented:
Thanks very much ... I tried View | Project Manager to view all files in the project. I did see all the required .lib there ... however, I still have the same errors ... what else could possiblely be a problem ??? many thanks !

0
WoodsterCommented:
Without having the library here to play wround with I am clutching at straws a little and you may need to try a bit of trial and error.  Firstly, am I correct in thinking that the original code you posted above compiled and linked?

(All the following in place of line00)

Does this compile and link:

EC24Image1.Draw(this->GetDeviceContext(this));

Does this compile and link:

HDC deviceContext = this->Canvas->Handle;
EC24Image1.Draw(this->Canvas->Handle);

Does this compile and link:

HDC deviceContext = this->GetDeviceContext(this);
EC24Image1.Draw(this->Canvas->Handle);
0

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:
All the three cases above didn't compile and link. They all have the same errors as I mentioned before. I guess I will double check the lib and functions ......

many thanks !!!

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