MapInfo Pro Developers User Group

Expand all | Collapse all

ActiveX connection between Map Info and Qt UI

  • 1.  ActiveX connection between Map Info and Qt UI

    Posted 12-11-2019 09:02
    Edited by Ott Koik 12-11-2019 09:14

    I'm working with custom tool set for MapInfo developed in C++ (Qt) and I have a problem connecting tool interface with specific MapInfo instance. Qt tool uses ActiveX (QAxWidget class and UUID) to connect with MapInfo, but issue occurs when there are multiple MapInfo instances running - when using only UUID to set QAxWidget control, the instance is not specified and therefore, tool "chooses" the first opened instance, which might not be the right one.

    My question is, how can I specify instance using, for example, HWND or the IDispatch OLE Automation pointer in Qt ActiveX widget.

    Of course, tool also have a MapBasic application for creating toolbar and with every button click, .exe file with specific parameters is executed and therefore, I can use MapBasic SystemInfo() function to add HWND or IDispatch to parameters as well. However, if and how can I use those values with QAxWidget?

    Best regards,

    Ott Koik
    Ruumab OÛ

  • 2.  RE: ActiveX connection between Map Info and Qt UI

    Posted 12-18-2019 10:31

    Pro registers an instance specific program id in the COM running object table that you can use (I think from GetObject()).

    The id looks like this, where the number at the end is the process id of the running instance of Pro.


    You can get the process id using this declaration:
    Declare Function GetCurrentProcessId Lib "kernel32" () As Integer

    Let me know if this helps. I am not familiar with QAxWidget, so don't know if this will solve your problem.


    Bob Fortin
    Software Architect and Distinguished Engineer
    MapInfo Pro Development Team