PDA

View Full Version : Using MapPoint In Delphi



Anonymous
03-21-2002, 10:48 PM
Jack Melgers explains how developers can go about using MapPoint within Delphi and provides several code snippets

Read the full article: http://www.mp2kmag.com/articles.asp?ArticleID=65

Anonymous
10-14-2002, 10:20 AM
Please can someone tell me why I get "...EAccessViolation with message 'Access violation at address 00000000. Read of address 00000000'..." whenever I run this code? (It always happens on the distanceto line.


Application.CreateForm(TFMapPoint, FMapPoint);

FMapPoint.OC1.CreateObject('MapPoint.Map.EU.9', False);
FMapPoint.OC1.DoVerb(1);
FMapPoint.OC1.OleObjectInterface.GetUserClassID(vG uid);
Map := IDispatch(FMapPoint.OC1.OleObject) as _Map;

mpResults1 := Map.FindResults('WR9 8UH');
oleCount1 := mpResults1.Count;
if &#40;oleCount1 < 1&#41; then
begin
ShowMessage&#40;'No results &#40;1&#41;'&#41;;
Exit;
end;

oleResult1 &#58;= 1;
ID1 &#58;= mpResults1.Item&#91;oleResult1&#93;;
Loc1 &#58;= Location&#40;ID1&#41;;

mpResults2 &#58;= Map.FindResults&#40;'SN8 2QE'&#41;;
oleCount2 &#58;= mpResults2.Count;
if &#40;oleCount2 < 1&#41; then
begin
ShowMessage&#40;'No results &#40;2&#41;'&#41;;
Exit;
end;

oleResult2 &#58;= 1;
ID2 &#58;= mpResults2.Item&#91;oleResult2&#93;;
Loc2 &#58;= Location&#40;ID2&#41;;


Dist &#58;= Loc1.DistanceTo&#40;Loc2&#41;;

//ShowMessage&#40;FloatToStr&#40;Dist&#41;&#41;;

FMapPoint.Release;
FMapPoint &#58;= nil;

Anonymous
10-28-2002, 05:59 PM
Hi

I cannot get either code example to work with Delphi 6.

The first method runs MapPoint but the window is invisible.

The second method takes 30 seconds to respond to the Zoom() call and uses 150Mb of memory whilst doing so.

Can anyone suggest why these methods don't work for me?

Thanks

Jim

Jim Burns
Delivearn Limited
Scotland

Garo
04-11-2003, 03:56 PM
Hi

I cannot get either code example to work with Delphi 6.

The first method runs MapPoint but the window is invisible.

The second method takes 30 seconds to respond to the Zoom() call and uses 150Mb of memory whilst doing so.

Can anyone suggest why these methods don't work for me?

Thanks

Jim

Jim Burns
Delivearn Limited
Scotland

I'm having the same problem. MapPoint is invisible when I initialize it and add some pushpins. But when I close the application mapPoint becomes visible and asks whether I want to save the changes or not.
Any hints how tro solve the problem?

Garo
04-11-2003, 04:32 PM
I solved the problem with invisible form. It seems when you assign mp Application.ActiveMap to mpMap it doesn't keep Application's Visible property's value. I replaced the code in the article



mpApplication.Visible &#58;= TRUE;
mpMap&#58;= mpApplication.ActiveMap;
mpMap.GoToLatLong&#40;43, -3, 100&#41;;


into



mpMap&#58;= mpApplication.ActiveMap;
mpMap.Application.Visible &#58;= TRUE;
mpMap.GoToLatLong&#40;43, -3, 100&#41;;


and now MapPoint is visible whenever I run the application.

Anonymous
05-10-2003, 09:06 AM
hi,
just got MapPoint 2002 and am trying to use the ActiveX control in Delphi,
but everytime I try to place it on my form I get the error "No such
interface supported". Then, there are only 2 component in "Active X" and Map Point Application isn't there.
best regards

Garo
05-10-2003, 11:11 AM
You need to import MapPoint ActiveX control before using it.
Check this article for instructions how to do that - http://mp2kmag.com/articles.asp?ArticleID=80&key=delphi.address.verifier

Anonymous
07-04-2003, 10:18 AM
You must run the latest version of the runtime librabry.

henk
12-05-2005, 09:51 AM
Thanks for this fabulous info on connecting MapPoint to Delphi!

Is it possible to connect the OleClassName/OleContainer to MapPoint installed on a serverlocation instead of local machine?

Adding a path to mpOleContainer.CreateObject('MapPoint.Map.EU.11',F ALSE) will probably not do the job? Can I manipulate my registery somehow? Does anybody know how to do this?