Purpose
A special function, called when a MapBasic program acts as a DDE server, and the DDE client performs a "peek" request. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
Declare Function RemoteQueryHandler() As String
Function RemoteQueryHandler() As String
statement_list
End Function
statement_list is a list of statements to execute upon receiving a peek request.
Description
The RemoteQueryHandler() function works in conjunction with DDE (Dynamic Data Exchange). For an introduction to DDE, see the MapBasic User Guide. An external application can initiate a DDE conversation with your MapBasic program. To initiate the conversation, the external application uses "MapInfo" as the DDE application name, and it uses the name of your MapBasic application as the DDE topic. Once the conversation is initiated, the external application (the client) can issue peek requests to request data from your MapBasic application (the server).
To handle peek requests, include a function called RemoteQueryHandler() in your MapBasic application. When the client application issues a peek request, MapInfo Pro automatically calls the RemoteQueryHandler() function. The client's peek request is handled synchronously; the client waits until RemoteQueryHandler() returns a value.
Example
The following example calls the CommandInfo() function to determine the item name specified by the DDE client. The item name is used as a flag; in other words, this program decides which value to return based on whether the client specified "code1" as the item name.
Function RemoteQueryHandler() As String
Dim s_item_name As String
s_item_name = CommandInfo(CMD_INFO_MSG)
If s_item_name = "code1" Then
RemoteQueryHandler = custom_function_1()
Else
RemoteQueryHandler = custom_function_2()
End If
End Function
See Also:
DDEInitiate() function, RemoteMsgHandler procedure