Individual DDE calls carry a lot of overhead; I suspect that it would be
faster to include the parameters in the message string sent to the MBX.
The application's RemoteMsgHandler would parse the string; the first atom in
the string would identify the function and the other atoms would identify
the parameters. A possible implementation follows.
Hope this helps
Spencer
Assuming that you can deduce what the following functions do:
Declare function SearchSArray (a(0) as string, ByVal ct as smallint, ByVal
SearchFor as string) as smallint
Declare function parse (ByVal s as string,
ByVal d as string,
a (0) as string,
ByVal pad as smallint) as smallint
Declare sub ErrorMessage (ByVal msg as string)
And you had implemented the following functions you wanted to be available:
Sub CreateMapPoint (ByVal mapwin as integer, ByVal x as float, ByVal y as
float)
Sub CreateMapLine (ByVal mapwin as integer, ByVal x1 as float, ByVal y1 as
float,
ByVal x2 as float, ByVal y2 as
float)
Sub CreateMapLabel (ByVal mapwin as integer, ByVal x1 as float, ByVal y1
as float, ByVal lbl as string)
You could implement RemoteMsgHandler this way (haven't tried to compile):
Define CREATE_POINT_FUNCTION 1
Define CREATE_LINE_FUNCTION 2
Define CREATE_LABEL_FUNCTION 3
Define AVAILABLE_FUNCTIONS 3
Dim fun_i (0) as float ' module level
Sub RemoteMsgHAndler
Dim na as smallint
Dim a (0) as string
Dim i as smallint
na=parse (CommandInfo (CMD_INFO_MSG), ",", a, 0)
If na > 0
then If ubound (fun_i) = 0
then redim fun_i (AVAILABLE_FUNCTIONS)
fun_i (CREATE_POINT_FUNCTION) = "CreatePoint"
fun_i (CREATE_LINE_FUNCTION) = "CreateLine"
fun_i (CREATE_LABEL_FUNCTION) = "CreateLabel"
end if
i = SearchSArray (fun_i, AVAILABLE_FUNCTIONS, a(1))
do case i
case CREATE_POINT_FUNCTION call CreateMapPoint (val(a(2)),
val(a(3)), val(a(4)))
case CREATE_LINE_FUNCTION call CreateMapLine (val(a(2)),
val(a(3)), val(a(4)),
val(a(5)), val(a(6)))
case CREATE_LABEL_FUNCTION call CreateMapLabel (val(a(2)),
val(a(3)), val(a(4)), a(5))
case else call ErrorMessage ("Illegal function
name """+a(1)+""".")
end case
else call ErrorMessage ("Empty message string.")
end if
end sub
_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l