Community of MapPoint and Virtual Earth Users and Developers
This is a discussion on HOW TO: MP addin using .NET within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; OK... I've looked and looked and looked and I can't find any information on creating a COM add-in for MapPoint ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| HOW TO: MP addin using .NET |
| |||
|
Hope this is what your looking for. Just start a new windows project. Go to the toolbar on the left and right click. Make sure that your view is in design. With the right click menu group open you should see an option Add/Remove Items... Click on that option and a Customize Toolbox window should appear. Click on the COM components tap at the top. It should already be there but look for the Microsoft Mappoint Control 11.0 and put a check in the checkbox. If not click on the browse button and make your way to the Mappoint 2004 installation directory and find the MapointControl.ocx file. Click Ok when you done Go back to your toolbox and scroll all the way down to the bottom. You should see the Mappoint control. Click on it and drag and drop the icon on the windows form. You should know see the windows control window on the form and everything that you need to build a Mappoint windows app is not part of your project. Private Sub LoadMappointControl() Dim ienum As IEnumerator Dim sStartupPath As String = Application.StartupPath Try m_oMap = mcMain.OpenMap(sStartupPath & "\MPSource.ptm") m_oMap.AllowEdgePan = True m_oMap.MapFont = MapPoint.GeoMapFont.geoMapFontSmaller m_oApp = m_oMap.Application '' HERE FOR FAIL SAFE. NEEED TO MAKE SURE THAT THE MP SOURCE FILE IS CLEAN OF ANY PREVIOUS DATA '' REMOVE ANY AND ALL DATASETS BEFORE ADDING NEW ONES If m_oMap.DataSets.Count > 0 Then ienum = m_oMap.DataSets.GetEnumerator() While ienum.MoveNext DirectCast(ienum.Current, MapPoint.DataSet).Delete() End While End If '' REMOVE ANY AND ALL SHAPES If m_oMap.Shapes.Count > 0 Then ienum = m_oMap.Shapes.GetEnumerator While ienum.MoveNext DirectCast(ienum.Current, MapPoint.Shape).Delete() End While End If '' TURN OFF ALL POS (points of interests) m_oMap.PlaceCategories.Visible = MapPoint.GeoTriState.geoFalse '' CLEAR ACTIVE ROUTE CALCULATIONS m_oMap.ActiveRoute.Clear() m_frmSS.IncrementProgressBar(10) ' ************************************************** *********************************************** '' LOAD CUSTOM SYMBOLS For Each m_mpSymbol In m_oMap.Symbols If m_mpSymbol.IsCustom Then Select Case m_mpSymbol.Name Case "GreenBldg" m_mpGreenBuildingSymbol = m_mpSymbol Case "RedBldg" m_mpRedBuildingSymbol = m_mpSymbol Case "Transparent" m_mpTransparentSymbol = m_mpSymbol End Select End If Next '' LOAD PROPERTIES m_dsMain.Tables.Add(LoadProperties()) m_frmSS.IncrementProgressBar(5) '' LOAD PERSONNEL m_dsMain.Tables.Add(LoadPersonnel()) m_frmSS.IncrementProgressBar(5) '' DISPLAY PROPERTIES DisplayProperties() m_frmSS.IncrementProgressBar(5) '' DISPLAY PERSONNEL DisplayPersonnel() m_frmSS.IncrementProgressBar(10) Catch ex As Exception Throw ex End Try End Sub |
| |||
| Quote:
|
| |||
|
Searching the microsoft.public.mappoint Usenet I see that this has been and unanswered issue since 2002 ( http://groups.google.com/groups?q=ma...4ax.com&rnum=1 ). Hasn't anyone figured this out in the last 2 years. I can't believe that MS hasn't released and updated msdn article. |
| ||||
|
Hey, I actually remember Gilles response from two years ago Actually the morning your post appeared here I forwarded it to a technical writer at MS and he said he started working on an article, but I don't know if he had figured it out yet.. I did a little poking around and was only coming up with the same knowledge base article - http://support.microsoft.com/?kbid=302896 Eric
__________________ |
| |||
|
After much searching I've discovered the issue. It has to do with the fact that .NET is managed code and therefore cannot create a self-registering COM object. The way around it is a very complicated task of creating a unmanaged code (called a shim) that does the registering of the managed .net com object. There are some very long and detailed instructions at MSDN ( http://msdn.microsoft.com/library/de...dc_comshim.asp ). I'll give it a try and if successful I'll post the results here. Although it doesn't appear that to many people are interested in creating com add-ins for MP. |
| |||
| I use C# for making an Office Add-in.
Its petty easy. I use C# to make my MapPoint 2002 and 2004 COM add-ins. Just compile with the IDispatch interface (or use the Office XP/2003 SDK for Visual Studio.NET) and tell it to create an Add-in only for MapPoint. Then add your refrences, remove all office traces from your files and compile and run the setup program it provides at least once after you build (to setup the links to MapPoint for your dll) and your set. Happy Coding. |
![]() |
| Tags |
| addin, net |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| mappoint addin | Milo | MapPoint 2006/2009 Discussion | 6 | 08-16-2005 01:33 PM |
| Drive Time Addin | kez100 | MapPoint 2006/2009 Discussion | 2 | 03-04-2004 07:29 AM |
| C# AddIn | Anonymous | MapPoint 2006/2009 Discussion | 0 | 12-20-2003 06:44 PM |
| COM AddIn in C++/ATL | Anonymous | MapPoint 2006/2009 Discussion | 3 | 10-22-2003 09:41 AM |
| Mappoint addin with Delphi 6 | jeanluc | MapPoint 2006/2009 Discussion | 2 | 09-15-2003 02:03 PM |