Greetings all. I had to integrate MapPoint into my Pdox 9 application.
From
all the history here, it seems like others were having trouble with this,
so I thought I'd post a basic solution - it even works in Runtime.
I'm using MapPoint 2004. If someone has 2006, can you test this to see if
it still works?
First, add the MapPoint ActiveX Control to the ActiveX toolbar. From
there,
add it to your form. Then, it's just a matter of controlling the control.
For some reason, you can't directly access the Map object. But, the OCX
has an ActiveMap property that returns the Map itself. The same applies
with the Route object - you use the ActiveRoute property to get the Route.
HTH,
Jim Moseley
method pushButton(var eventInfo Event)
var
oaMP1,
oaMap,
oaRoute,
oaStops,
oaLocation
oleAuto
dyn dynarray[] anytype
endVar
doDefault
MapPointOCX.NewMap(1)
;while not MapPointOCX.ReadyState = 4
; sleep(200)
;endWhile
if not oaMP1.attach(MapPointOCX) then
errorShow()
return
endif
oaMap = oaMP1.ActiveMap
oaRoute = oaMap.ActiveRoute
oaRoute^clear()
oaStops = oaRoute.WayPoints
oaLocation = oaMap^getLocation(30.299, -81.708)
oaStops^add(oaLocation, "Start")
oaLocation = oaMap^getLocation(33.321, -83.321)
oaStops^add(oaLocation, "Stop 1")
oaLocation = oaMap^getLocation(35.321, -82.321)
oaStops^add(oaLocation, "End")
oaRoute^calculate()
driveTime = round(oaRoute.DrivingTime * 24,2)
endMethod


|