MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth Users and Developers




HOW TO: MP addin using .NET

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 ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Today's Posts Twitter Feed Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-10-2004
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 05-13-2004
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 05-13-2004
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 05-14-2004
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 05-14-2004
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 05-15-2004
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 3,041
Blog Entries: 2
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
__________________
~ Now taking orders for MapPoint 2009 ~
~~
~ Upgrade to MapForums Plus membership ~
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 05-15-2004
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 05-15-2004
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 3,041
Blog Entries: 2
I think many if not most developers are still using VB6/VBA for MapPoint 2004 and VS.NET for MWS and MLS.

Eric
__________________
~ Now taking orders for MapPoint 2009 ~
~~
~ Upgrade to MapForums Plus membership ~
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 05-31-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
MP Addin using VB.Net

I am VERY interested.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10 (permalink)  
Old 07-05-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
addin, net


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

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


All times are GMT -5. The time now is 03:33 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC2
MP2K Magazine
Visitor Map

Florida Holiday
Book your Florida holiday through UlookUbook and save cash!



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