MapInfo Pro Developers User Group

 View Only
  • 1.  Using Python for scripting in MapInfo Pro

    Posted 05-13-2020 04:44
    Good afternoon. Please tell me how to pass MapInfo hwnd to Python

    ------------------------------
    Boris Rubtsov
    ESTI MAP (VAR)
    MOSCOW
    ------------------------------


  • 2.  RE: Using Python for scripting in MapInfo Pro

    Employee
    Posted 05-13-2020 05:21
    Hi Boris

    In the Hello World Python sample that comes with MapBasic you can find this where we pass a reference to the MapInfo Pro object to Pyhon:

    mapinfoApplication = SYSTEMINFO(SYS_INFO_IMAPINFOAPPLICATION)
    mbAddIn = New_PythonCustomFrameAddin()
    if mbAddIn <> 0 Then
       call InitializePyAddin(mbAddIn, mapinfoApplication, ApplicationDirectory$() + ApplicationName$())
    End if


    You could pass the reference to the HWND in a similar way. I'd expect that you can get to this HWND via one of these functions:
    • WindowInfo( WIN_MAPINFO, WIN_INFO_WND)
    • SystemInfo(SYS_INFO_MAPINFOWND)

    If this isn't what you are looking for, maybe give us some more information on what you are trying to do.

    ------------------------------
    Peter Horsbøll Møller
    Distinguished Engineer
    Pitney Bowes Software & Data
    ------------------------------



  • 3.  RE: Using Python for scripting in MapInfo Pro

    Employee
    Posted 05-19-2020 09:27
    Hello Boris,

    You can use the MainHwnd property on the IMapInfoPro interface to get the MapInfo Pro main window handle in Python script.

    Thanks
    Anshul

    ------------------------------
    Anshul Goel
    Knowledge Community Shared Account
    Shelton CT
    ------------------------------