MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth Users and Developers




Got Mappoint ActiveX working in Delphi 5

This is a discussion on Got Mappoint ActiveX working in Delphi 5 within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I noticed that a lot of people are having this problem (as was I) but I now have the mappoint ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Today's Posts Twitter Feed Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-08-2003
Junior Member
White Belt
 
Join Date: Oct 2003
Posts: 5
Got Mappoint ActiveX working in Delphi 5

I noticed that a lot of people are having this problem (as was I) but I now have the mappoint activex control working w/in delphi.

It turns out that the mappoint ocx does not support the IPersistStreamInit interface, which delphi uses to store the activex in the dfm.
That is why you get the error... "Interface not supported".
Mappoint does not support (or from what I can tell... need) this. As long as you are loading your maps programmatically then this will not be a problem.

I can't post the source code due to the fact that I had to modify Borland code and posting it would be illegal. I will however... tell you how to modify the code yourself.

I basically had to copy the whole OleCtrls.pas file into a new file I call OleCtrlNoPersist.pas and inside of there removed the following methods/variables from the TOleControl.

- FPersistStream variable (and all references in the Create, Destroy, CreateControl and DoObjectVerb methods)
- FObjectData variable (and the "if" block it's referenced in from CreateControl (which will have to be gone for FPersistStream anyways))
- Stream variable of the CreateControl method (not needed anymore due to the "if" block above being removed)
- DefineProperties method (which does the actual storage)
- CreateStorage method
- DestroyStorage method (and its reference in the Destroy method. The reference in CreateControl should be gone if you removed the "if" block described above)
- WriteData method (used by DefineProperties)
- ReadData method (used by DefineProperties)

You can then change all references of TOleControl to TOleControlNoPersist throughout the whole unit.

Once that is done and I have imported the MapPoint Activex control all I have to do is change the TMappointControl object to descend from TOleControlNoPersist (including changing the uses from OleCtrls to OleCtrlNoPersist).

Recompile your package and drop the TMappointControl on a form... call the NewMap(geoMapNorthAmerica) on it... and there you have it.

I did all this in the last little bit so I'm not totally sure that there are no other problems as of yet. I will know soon enough tho, since the project I'm working on has to be done in a few days.

If you have any other questions then please go ahead and e-mail me.
Please don't ask for the source code because I have no way of verifying that I'm not breaking the law by giving it to you. Everything you need should be above.

FWI... I have not even checked to see if this works in D6 or D7 or if it's even a problem cause the current project I'm working on is in D5

Enjoy,
Chris Menser (cmenser@phatrock.com)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 10-08-2003
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 3,041
Blog Entries: 2
Very cool, thanks Chris.
__________________
~ Now taking orders for MapPoint 2009 ~
~~
~ Upgrade to MapForums Plus membership ~
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 10-27-2003
Junior Member
White Belt
 
Join Date: Oct 2003
Posts: 4
I've not seen this post before this morning, but today will be a great day !!
I've made change like you tell and it's work very well on Delphi 7 !
Just a little problem in design time, i can't resize control with my mouse, i must write pos and size in the object inspector directly.
But it's not very disturbing...

Many thanks for your post !!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 10-27-2003
Junior Member
White Belt
 
Join Date: Oct 2003
Posts: 5
Quote:
Originally Posted by Gauloisid
I've not seen this post before this morning, but today will be a great day !!
I've made change like you tell and it's work very well on Delphi 7 !
Just a little problem in design time, i can't resize control with my mouse, i must write pos and size in the object inspector directly.
But it's not very disturbing...

Many thanks for your post !!
I also noticed that you can't select it in design time. I had it on a panel set to alclient so I hadn't noticed it until the other day. I might look into that but I doubt it.... just not a pressing issue to me

Good to know about the D7 thing tho... thanks. I was writing an addon to an existing app that was done in D5 but I will be converting it to D7 here shortly so I'm glad it works

If you have any more questions don't hesitate to e-mail me.

Thanks,
Chris Menser (cmenser@phatrock.com)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 04-08-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Upon following the directions in order to allow MapPoint to be used in Delphi. I find that it works up to a point!

I can now not use any APPLICATION type functions. i.e Application.ProcessMessages etc.

Delphi gives an error stating that an object or class is required.

Upon removing the MapPoint_TLB item from the USES list, Application is recognised and compiles correctly, but of course without mappoint.

Any ideas as to what's causing this, and how I can continue using Application. etc.

I'm using Delphi 6 Enterprise.

Regards
Les
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 04-15-2004
Junior Member
White Belt
 
Join Date: Apr 2004
Posts: 2
It works, but I still have problems

Great solution! Now I can indeed place the TMapPointControl on a form.

I can call
MappointControl1.DoObjectVerb(1);
Caption:=MappointControl1.Build;
any many other methods/properties.

but creating a new map always fails
MyMap:=MappointControl1.NewMap(geoMapEurope);

The error message is (translated from german) "Error loading mappoint: Unknown error"

If I try
MyMap:=MappointControl1.NewMap(geoMapNorthAmerica) ;
I get the correct message "Map not registered".

Using Mappoint 2004 in an OLEContainer does work fine, but of course there I can't get the events (MouseDown, RouteAfterCalculate).

Any suggestions what I should change?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 04-15-2004
Junior Member
White Belt
 
Join Date: Apr 2004
Posts: 2
Heureka

Simple mistake: Don't call NewMap() in CreateForm! After that it works perfectly! I use Delphi 7.

Thanks again, Guido
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 03-03-2005
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
What I did was to copy the OleCtrl.pas file in my sourcedirectory and included it in my project.
Then I created the Mappoint control in the on form create event with as parent a panel.
Set a breakpoint in the "constructor TOleControl.Create(AOwner:
TComponent);" routine from the OleCtrl.pas file
you have to debug it twice and there are two lines you have to gray out as comment
1) OleCheck(FOleObject.QueryInterface(IPersistStreamI nit,FPersistStream));
2) OleCheck(FPersistStream.Load(Stream));

Now the application will compile correctly.

Load your map in the on Form.Activate event and there you go...

HTH
Regards,
Peter
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 02-12-2008
Junior Member
Yellow Belt
 
Join Date: Jan 2007
Posts: 16
Re: Got Mappoint ActiveX working in Delphi 5

Thanks a lot : it works perfectly on Delphi 7 fr
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
activex, delphi, mappoint, working


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Mappoint 2004 ActiveX Delphi 2005 How to add a Polyline it-fraggel MapPoint 2006/2009 Discussion 3 04-04-2006 01:23 PM
MapPoint ActiveX Wrapper for Delphi 5/7 Anonymous News and Announcements 4 11-18-2003 09:15 AM
Hi there. Working with MapPoint 2002, Is it pos.... Anonymous MapPoint 2006/2009 Discussion 1 06-25-2002 09:36 AM
I am working with Mappoint in Pakistan and I want .... Anonymous MapPoint 2006/2009 Discussion 1 06-22-2002 09:02 AM
i have added the activeX component(s) to delphi. .... Anonymous MapPoint 2006/2009 Discussion 1 02-01-2002 04:35 AM


All times are GMT -5. The time now is 11:48 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC2
MP2K Magazine
Visitor Map

Menorca Holiday
Enjoy a Menorca holiday at a great rate when booked through UlookUbook!



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59