Purpose
A reserved procedure name, called when a remote application sends an execute message.
Syntax
Declare Sub RemoteMsgHandler
Sub RemoteMsgHandler
statement_list
End Sub
statement_list is a list of statements to execute upon receiving an execute message.
Description
RemoteMsgHandler is a special-purpose MapBasic procedure name that handles inter-application communication. If you run a MapBasic application that includes a procedure named RemoteMsgHandler, MapInfo Pro automatically calls the RemoteMsgHandler procedure every time another application (for example, a spreadsheet or database package) issues an "execute" command. The MapBasic procedure then can call the CommandInfo() function to retrieve the string corresponding to the execute command.
You can use the End Program statement to terminate a RemoteMsgHandler procedure once it is no longer wanted. Conversely, you should be careful not to issue an End Program statement while the RemoteMsgHandler procedure is still needed.
Inter-Application Communication Using Windows DDE
If a Windows application is capable of conducting a DDE (Dynamic Data Exchange) conversation, that application can initiate a conversation with MapInfo Pro. In the conversation, the external application is the client (active party), and a specific MapBasic application is the server (passive party).
Each time the DDE client sends an execute command, MapInfo Pro calls the server's RemoteMsgHandler procedure. Within the RemoteMsgHandler procedure, you can use the function call:
CommandInfo(CMD_INFO_MSG)
where:
CMD_INFO_MSG (1000)
to retrieve the string sent by the remote application. The DDE conversation must use the name of the sleeping application (for example, "C:\MAPBASIC\DISPATCH.MBX") as the topic in order to facilitate RemoteMsgHandler functionality.
See Also:
DDEExecute statement, DDEInitiate() function, SelChangedHandler procedure, ToolHandler procedure, WinChangedHandler procedure, WinClosedHandler procedure