PDA

View Full Version : C# Code To Load Older COM Version



PEB
05-09-2012, 09:27 AM
I have a user who is currently using MapPoint 2006. When they install MP 2011 (side by side with 2006), my app will automatically start using the 2011 version of the COM component. But my user will still need to create maps for users stuck on 2006.

Does anyone know a way to dynamically switch the MapPoint COM version either by unloading/loading or by allowing the user to select the version at app startup? Is this even going to be possible?

Thanks,
Patrick

Eric Frost
05-09-2012, 10:52 AM
I'm not sure how to do it with the COM component, but when you are automating the application, you can specify the version when you create the object e.g.

Set MPAPP = CreateObject("MapPoint.Application.19")

Or something like that. There is a section in the help file that discusses this. Maybe they also have some tips on controlling the version of the MapPoint COM object?

Another thing to try is in the MP06 Program Files folder, type in > mappoint.exe /regserver This re-registers MapPoint and makes that version the default.

Let us know how it goes!

Otherwise yeah I'd recommend not to have MP11 on the same machine.

Eric

PEB
05-09-2012, 10:57 AM
Thanks Eric, I'll look into both of your suggestions and update the thread with my final solution.

PEB
05-29-2012, 07:14 AM
I went with the solution of calling mappoint.exe /regserver. So when a user sets the preference of running a different MP version, I call /regserver and relaunch my program. Works great. Thanks again, Eric, for the suggestion.

Eric Frost
05-29-2012, 07:43 AM
Oh great! Thanks for the follow up. Let us know if you run into other obstacles or have questions!

Eric

Winwaed
05-29-2012, 10:06 AM
Yes the '/regserver' option has the effect of changing the default version. In theory opening & saving a map with the required version, should do this - but doesn't always. The most reliable way is to uninstall and re-install the required version, but this is time consuming!