Community of VE/MapPoint Users and Developers
This is a discussion on C# Late Binding Application within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi, didn't find anything like that here but here some kinky different way to do things. Maybe some of you ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| C# Late Binding Application didn't find anything like that here but here some kinky different way to do things. Maybe some of you can use it, but use it wise. ![]() using System.Reflection; Get MapPoint: object mapPoint = Activator.CreateInstance(Type.GetTypeFromProgID("M apPoint.Application.EU.13")); Now you can work with it, unless it's the right Id ^^ Get a Property: object activeMap = mapPoint.GetType().InvokeMember("ActiveMap", BindingFlags.GetProperty | BindingFlags.OptionalParamBinding, null, mapPoint, new object[0]); Call a Method: object results = activeMap.GetType().InvokeMember("FindAddressResul ts", BindingFlags.InvokeMethod | BindingFlags.OptionalParamBinding, null, activeMap, new object[6] { "Musterweg", "Stuttgart", "", "", "", "Deutschland" }); Set a Property: activeMap.GetType().InvokeMember("Saved", BindingFlags.SetProperty, null, activeMap, new object[1] { true }); Let's get dirty ![]() |
| |||
| Re: C# Late Binding Application
Hi, Thanks for sharing. Can you come up with an idea where this can be interesting or even encouraged ?
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Re: C# Late Binding Application
It's usefull if you just want to have data from MapPoint without the connection to your controls. You don't have to reference MapPoint in your project and it's quite direct an simple to programm. Bad Point: long instructions (Needed to display the Map on a Floating Panel so this was a dead end at that part, if some of you know how to connect it with a control just post it, i didn't had the time to test or search) |
| |||
| Re: C# Late Binding Application
hi, thanks for clarifying. I do not understand the reason completely. Can you enlighten some more ? This can be interesting to put on the FAQ.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Re: C# Late Binding Application
Hmm i'm no Pro so i do not know ^^ ... I think you asked why i tried to Late Binded it ... Scenario: Want to use MapPoint if the Client has MP2006 and don't even want to show him the options of using it if not. Like a feature. Now, if i reference it in the project (c# visual studio 2005) an compile it and execute it on another pc that doesn't have mp2006, it crashs on start-up. This is as far as i understood the Problem. If i late binde it, and catch the problematic parts (when i make an instance of mp or call it) in try-catch blocks, i can prevent the application from crashing. The code above uses Late Binding and you don't have to visualize it, hang mp in a form, etc.. You just need the Distance or DrivingTime, just call it with the functions above. But beware, long instuctions if you don't encapsule them your code will explode. ^^ Btw. MapPoint ocx is a b****, had to enbedd it in a form to prevent it from closing dirty, like "save-popup" at different states of the closing-mainform, mp-crash at the end of my application ... just learned 1 thing from it, give it a form, hide it, use it, give the control back to the form before closing other forms and let the form kill the mp ocx .... confusing ... (just updated the segment info in my table after optimizing, directions list (of the route) didn't have the last waypoint of the route and other kinky ways of saving stuff. Needed a 2-while-algo to just get the distance an time between the waypoints ... not very clever done) |
![]() |
| Tags |
| application, binding, late |
| ||||
| Posted By | For | Type | Date | |
| MapPoint User Community - MP2K Magazine | This thread | Refback | 08-15-2007 10:55 PM | |
| User:Mapelves - MapElves | This thread | Refback | 08-12-2007 02:28 PM | |
| MapPoint Download - MP2K Magazine | This thread | Refback | 08-08-2007 09:01 AM | |
| Using Autoroute 2003 Data in MapPoint 2002 - MapPoint Articles - MP2K Magazine | This thread | Refback | 08-06-2007 11:21 AM | |
| A More Compact Method for Obtaining Lat/Long - MapPoint Articles - MP2K Magazine | This thread | Refback | 08-06-2007 11:13 AM | |
| MapPoint Help - MP2K Magazine | This thread | Refback | 08-06-2007 09:41 AM | |
| A More Compact Method for Obtaining Lat/Long - MapPoint Articles - MP2K Magazine | This thread | Refback | 08-06-2007 04:13 AM | |
| Lat/Long in MapPoint 2002 - MapPoint Articles - MP2K Magazine | This thread | Refback | 08-06-2007 03:57 AM | |
| A More Compact Method for Obtaining Lat/Long - MapPoint Articles - MP2K Magazine | This thread | Refback | 08-06-2007 03:55 AM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Application cannot call MP | joe1156 | MapPoint 2006/2009 Discussion | 3 | 05-24-2007 08:29 AM |
| Sample application in c# | alt-088 | MapPoint 2006/2009 Discussion | 3 | 09-16-2004 04:35 PM |
| Cant See Mappoint.Application from VB | Anonymous | MapPoint 2006/2009 Discussion | 2 | 04-15-2004 11:15 AM |
| Can a MapPoint control be conditionall loaded or late bound? | frankp | MapPoint 2006/2009 Discussion | 2 | 02-28-2004 10:50 PM |
| Pb with another application | Anonymous | MapPoint 2006/2009 Discussion | 0 | 12-17-2002 04:53 AM |