Community of VE/MapPoint Users and Developers
This is a discussion on Can't GetActiveMap from a Thread within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi, I have an MFC app which has a mappoint ocx control. I call AfxBeginThread to update a bunch of ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Can't GetActiveMap from a Thread Both threads do need to access the same CMappointCtrl and all it's parts, but not at the same time. While the AfxBeginThread() thread is running, the main thread doesn't need to touch it at all. Thanks. Stu |
| |||
|
Hi Stu, I think that if the control is created in main thread that you have to access all also from the main thread. So you can do several things from out of your other threads. - Send a message to the main thread The thread will block until the custom message handler is ready. Some of the mappoint things will generate a stupid syncrounious error. - Do the same with PostMessage. This one is async. So thread will contnue.Mappoint will not complain. In both of this, the custom message handler will execute in main thread context. If you dont know these are Win32 API calls and you can P/Invoke to run them in dotnet. Possible you can do the same with Invoke / BeginInvoke (same for sync/async) if you create events in your threads. In that case you can let the events execute in main thread context. Note that with all that synchronizing, you are actually disabling multithreading, so another question is do you really need threads ?
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
![]() |
| Tags |
| getactivemap, thread |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Load new map in separate thread to keep ui responsive? | TicK | MapPoint 2006/2009 Discussion | 3 | 11-11-2005 01:07 PM |
| Updating map in mapcontrol, through secondary thread | malkotian | MapPoint 2006/2009 Discussion | 1 | 08-16-2005 03:44 PM |
| is Mappoint thread safe | Wilfried | MapPoint 2006/2009 Discussion | 5 | 04-06-2005 02:50 PM |