Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

HOW TO: MP addin using .NET

This is a discussion on HOW TO: MP addin using .NET within the MapPoint Desktop 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 ...

  1. #1
    Labtek is offline Member Yellow Belt
    Join Date
    Mar 2003
    Posts
    41

    HOW TO: MP addin using .NET

    OK... I've looked and looked and looked and I can't find any information on creating a COM add-in for MapPoint using VB.NET (or any .NET). I've seen Chandu Thota's article titled "Programming with MapPoint 2004 using the .NET Framework" ( http://www.mp2kmag.com/a103--chandu.....mappoint.html ) but that is just information for automating MapPoint within a .NET application. I've followed the instructions in Microsoft Knowledge Base Article 302896 "HOW TO: Build an Office COM Add-in by Using Visual Basic .NET" ( http://support.microsoft.com/default.aspx?kbid=302896 ) which seams to describe creating a .NET COM addin but when I try to use that addin in MapPoint I get an error that my DLL is not a valid office addin. I know it can be done apparently gpxExchange ( http://homepage.mac.com/donreith/gpxExchange/ ) is build using .NET. I have quite a bit of experience in MapPoint addins in VB 6.0 ( http://www.hypercubed.com/projects/coordex/ ) but VB.NET is new to me. Any help is appreciated. I think this is a topic ripe for a MP2Kmag article.

  2. #2
    Labtek is offline Member Yellow Belt
    Join Date
    Mar 2003
    Posts
    41
    If someone has developed a MP plugin using .NET it would be great if you could post your project (or subset) as an example.

  3. #3
    matnace is offline Junior Member White Belt
    Join Date
    Nov 2003
    Posts
    3
    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

  4. #4
    Labtek is offline Member Yellow Belt
    Join Date
    Mar 2003
    Posts
    41
    Quote Originally Posted by matnace
    Hope this is what your looking for.
    Thanks but No... I think what you are doing here is creating a .NET executable (.EXE) that can use the MP COM object (Mappoint Control 11.0). What I am looking for is a way to create a .NET DLL that can be used inside MP as a COM addin. This article on MSDN ( http://msdn.microsoft.com/library/en...asp?frame=true ) shows clearly how to make a COM add-in for MapPoint using vb 6.0. I have tried to do something similar to this in .NET by exposing the same function (AddinInstance_OnConnection, etc) but MP wont recognize my DLL as a valid office add-in. I'm surprise that nobody has done this.

  5. #5
    Labtek is offline Member Yellow Belt
    Join Date
    Mar 2003
    Posts
    41
    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.

  6. #6
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4
    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
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  7. #7
    Labtek is offline Member Yellow Belt
    Join Date
    Mar 2003
    Posts
    41
    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.

  8. #8
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4
    I think many if not most developers are still using VB6/VBA for MapPoint 2004 and VS.NET for MWS and MLS.

    Eric
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  9. #9
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    MP Addin using VB.Net

    I am VERY interested.

  10. #10
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    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.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. mappoint addin
    By Milo in forum MapPoint Desktop Discussion
    Replies: 6
    Last Post: 08-16-2005, 02:33 PM
  2. Drive Time Addin
    By kez100 in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 03-04-2004, 08:29 AM
  3. C# AddIn
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 12-20-2003, 07:44 PM
  4. COM AddIn in C++/ATL
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 10-22-2003, 10:41 AM
  5. Mappoint addin with Delphi 6
    By jeanluc in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 09-15-2003, 03:03 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96