Okay,
I tried using the "MIObj1 = New MapInfo.MapInfoApplication and that gets rid of any error, however MapInfo is already runnning and I need the current instance of the running copy.
Again it is error free but the MIobj1 does not know the instance that I am trying to set itself to so there seems to be no connection to the current running mapinfo and nothing happens in MapInfo.
I am finding there are several differences in the way MapInfo 11.5.1 and MapInfo 12.0 have been implemented in the
VB.NET environment.
In MapInfo 11.5.1 the interop.mapinfo.dll was not listing under COM objects but added in via the browse and labeled as a .NET assembly.
Now MapInfo 12.0 shows up under .COM and I have added it in as such.
I have tried
Public Shared Function GetRunningMapInfo() As MapInfo.MiPro.Interop.MapInfoApplication
' Dim MIobj1 As MapInfo.MiPro.Interop.MapInfoApplication = Nothing
If Process.GetProcessesByName("MAPINFOW").Length <> 0 Then
'Get a pointer to the Word application
Try
'MIObj1 = System.Runtime.InteropServices.Marshal.GetActiveObject("Mapinfo.Application")
MIObj1 = GetObject("Mapinfo.Application")
Catch ex As Exception
MsgBox(ex.Message)
End Try
Else
'Create a new instance of the word application
MIobj1 = Nothing
End If
GetRunningMapInfo = MIobj1
End Function
Then I get "Can not create ActiveX component" error message.
Then immediately after that "Object Reference not set to an instance of an object"
I have all of my imports
Imports System.IO
Imports System.Text
Imports System.Timers
Imports System.Net.Sockets
Imports System.Windows.Forms
Imports MapInfo
Imports MapInfo.MiPro
Imports MapInfo.MiPro.Interop
Imports MapInfo.MiPro.Interop.MapInfoApplication
Imports Microsoft.VisualBasic
So I do not think that is an issue.
I am still working on it, but thought I would update my findings.