-1

I have to 2 separate codes that I need to combine using Visual Studios 2013 on Windows 7. The first one is a console application using OpenCV, Qt, and Intraface. The second is a Windows application that came from Microsoft´s Magnification API. They both work separately on their own, however I´m having trouble putting them together. I want to use Microsoft´s code to magnify sections of the screen, but instead of getting an input from the location of the mouse cursor on the screen, I want to receive the input from the 1st code.

I was wondering how I can go about calling the first code in order to retrieve this position. Would I just have to add all the header and source files from the first code into the Magnification project? And then call the necessary function in the Magnification project´s main loop, so that it can update the position accordingly?

I´m new to C++, but I would really like to accomplish this. Any guidance at how I should approach this would be very much appreciated. Thank You!

Joissa.R
  • 111
  • 1
  • 3
  • 8
  • 2
    You are going about this the wrong way. Attempting to do this with no knowledge of the C++ linking process, and no knowledge of the Windows API, is bound to lead to confusion and mistakes. Take some time to learn the basics. – David Heffernan Aug 17 '15 at 21:21
  • 1
    Hint: you need to link with `magnification.lib`. – Jonathan Potter Aug 17 '15 at 21:32
  • What exactly do you mean when you say that you want to "merge" two programs? Into what exactly? – Dan Korn Aug 17 '15 at 21:36
  • @JonathanPotter When I merged the two codes, I included the magnification.h header file in the .cpp and edited the project properties under the Linker general tab to include the location of the .lib file. And included the magnification.lib file in the Linker Input tab. Do I need to do anything more? – Joissa.R Aug 17 '15 at 21:40
  • It appears you have two different image processing libraries, OpenCV and Magnification API, and two different windowing or multi-threading platforms, Qt and Windows API, and are trying to mash them together. This does not sound like something that is suitable for this forum. see if you can make your question more specific. – Richard Chambers Aug 17 '15 at 21:41

1 Answers1

1

You seem to have done everything right, except that you don't link with the magnification library.

If you look at the documentation of one of the missing functions, such as MagInitialize, you'll see that you need to link your program with magnification.lib.

Given that your program is most likely set up with a qmake project file (with a .pro extension), edit the project file and add the following line anywhere in the file:

LIBS += -lmagnification

Since that library is a part of the Windows SDK, the linker knows where to find it and you don't need to provide a path to it - as long as you're using Microsoft compilers. If your compiler is mingw, things may be different; I'm not sure if mingw includes magnification.lib or not.

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313