[GIS] Trying to completely Exit from the MapInfo application

mapbasic

I tried the following two things:

 include "mapbasic.def"

 Declare Sub Main
 Declare Sub Exit

Sub Main()

    If WindowInfo(WIN_MAPBASIC, WIN_INFO_OPEN) then
        Close Window WIN_MAPBASIC
    End If

 End Sub

and

 Sub Exit()
    End Program
 End Sub

But my MapBasic program does not completely exit from MapInfo (close MapInfo).

Best Answer

Let's start by looking at your two statements:

This statement will close the MapBasic Window:

Close Window WIN_MAPBASIC

This statement will end your MapBasic application and unload it from memory:

End Program

If you want to shot down MapInfo Professional, you should run this statement:

End MapInfo Interactive

The keyword 'Interactive' makes sure that you are giving the user a chance to save what has not already been saved, either changes to a table or settings to a workspace.

Related Question