MapInfo Pro Developers User Group

Expand all | Collapse all

Using Python for scripting in MapInfo Pro

  • 1.  Using Python for scripting in MapInfo Pro

    Posted 15 days ago
    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

    Posted 15 days ago
    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 9 days ago
    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
    ------------------------------