View Full Version : vb.NET / MapPoint 2013 OCX ActiveX - Threading -> Copy MapPoint.Route to an other instance

09-02-2014, 08:52 AM
Hey ho,

I'm working now since a few weeks with mappoint. And now i have a big problem. I try to simulate the "mappoint-progressbar" dialog for calculte/optimizing a route.
So i have my UI-Thread where i open a second form (for the progressbar) and start a new thread in form1 for calculating the route.
Now i tried to start a second mappoint prozess (that works) but i have to copy the waypoints from the original thread to the second one. So i hope i can run the calculation in the second
thread. (If i didn't do this everything works, but there is on bug wich will freez my forms -> i start mappoint in the ui thread :hang:) Is there any way to do this?

I hope you know what i mean :eek2:

09-02-2014, 10:52 AM
It is possible to run a progress form but it isn't going to be able to connect with the optimize function's actual progress. Ie. it will just be a "doing work" indicator that would continue regardless of the state of the optimization (although at the end of the optimization you can kill the progress bar).

The secret is to keep all your GUI actions in one thread, and all your MapPoint actions in another. In theory it is possible to use multiple threads to access MapPoint but this can cause a lot of problems (some not where you might expect them). It is far easier to restrict all communication to a MapPoint instance through one thread.

I'm not sure what you mean about copying route information: If you are trying to copy a MapPoint COM object from one MapPoint instance to another, then you cannot do this directly. You will have to extract the information and then re-create the object.
(also I don't see how having two MapPoint instances any progress bar problem)