I'm developing an app in MapBasic that calls methods in a .NET assembly library
This is how I Declare the method in my MapBasice enviroment.
Declare Method showMainWindow Class "mynamespace.AldebaranInterface" Lib "Aldebaran.dll" ()
Sub ShowWindow
Call showMainWindow()
End Sub
Sub formEventHandler
'Reacting to some button click. I need to call this Sub from somewhere in mynamespace.AldebaranInterface
End Sub
What I need is to callback some Sub or Funcion in my MapBasic application from my .NET C# code. Let's say execute some portion of MapBasic code when the user clicks some button that is in my .NET form.
Is there a way to do that? If so. How can I achieve it? Any Help would be highly appreciated.
I'm not sure what is your .dll is supposed to do, I guess it's a form, since you need your mapbasic code to react to button click.
In order to send command to mapbasic you need to create instance of Mapinfo’s COM object. Here is the link on how to do it. I personally use second approach.
So after you create class:
, you need to add button clicked event:
Now on MapBasic side, you should create Sub RemoteMsgHandler (MapBasic Reference: A reserved procedure name, called when a remote application sends an execute message.)