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
Chris Menser (email@example.com)