Community of MapPoint and Virtual Earth Users and Developers
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 ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Got Mappoint ActiveX working in Delphi 5 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) |
| |||
|
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 !! |
| |||
| Quote:
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) |
| |||
|
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 |
| |||
| 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? |
| |||
|
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 |
![]() |
| Tags |
| activex, delphi, mappoint, working |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| 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 |
Menorca Holiday
Enjoy a Menorca holiday at a great rate when booked through UlookUbook!