0

I have a photosensitive device frontend from Thorlabs (KPA101) of which I am trying to get the signals values through a call of a method (ReadSumDiffSignals) of a COM/ActiveX object (APTQuad).

Thorlabs give an example of how to do that using VC++ but I cannot get a licence for VC++/VS for various reasons I will not bore you with. Is it possible to do that in any other IDE (say, Code::Blocks?), and if so, how?

I've searched a lot for that lately, in vain.

Mister Mystère
  • 952
  • 2
  • 16
  • 39
  • Visual Studio Community Edition has a free (as in beer) license. If your company is big enough, you can't use that, but at that point buying Visual Studio is cheaper than trying to do this without VS. – MSalters Jul 22 '20 at 14:05
  • COM is a protocol, not an IDE feature. You can use any compiler to consume a COM object, though Visual Studio has significant COM that can make it easier. – IInspectable Jul 22 '20 at 15:03
  • My company is big but big as in big bureaucracy, a licence is unfortunately off the table. How would I go with another IDE ? – Mister Mystère Jul 22 '20 at 15:10
  • If you have a sample no too complicated somewhere, we can try to see what's specific to Visual Studio and adapt it, as you should not need Visual Studio to use a COM object. – Simon Mourier Jul 22 '20 at 20:21
  • Thanks. Unfortunately the only thing I have is a video from the manufacturer which does not show much... https://www.thorlabs.com/tutorials/APTProgramming.cfm – Mister Mystère Jul 22 '20 at 20:52
  • Since the documentation offers tutorials that use Visual Basic, it's fairly safe to assume, that the ActiveX control exposes an `IDispatch` interface. That means, you can query the ActiveX control for all methods it offers, including the number and type of parameters. It probably also comes with a Type Library that contains all the metadata, and - if you're lucky - documentation for the exported interface(s). – IInspectable Jul 23 '20 at 08:04
  • I have the documentation for the ActiveX interface, I just don't know how to instantiate AcriveX objects and call methods from programs in C++ which are not made with VC++. Do you know how to use the IDispatch then ? – Mister Mystère Jul 23 '20 at 10:45
  • [Creating an Object in COM](https://learn.microsoft.com/en-us/windows/win32/learnwin32/creating-an-object-in-com) explains how to create an object. If the interface comes with C or C++ header files, you can immediately access the COM object. If there isn't, you can try to produce a header file from the Type Library. If there isn't a Type Library, you're going to have to query for the `IDispatch` interface. Try and see whether [this](https://learn.microsoft.com/en-us/previous-versions/windows/desktop/automat/implementing-the-idispatch-interface) helps you understand the concepts. – IInspectable Jul 23 '20 at 13:37

0 Answers0