Community of VE/MapPoint Users and Developers
This is a discussion on mappoint addin within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Im trying to create an addin for mappoint using vb and need some sort of tutorial or if someone has ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| mappoint addin Thanks Milo
__________________ ========= Milo |
| ||||
|
What kind of advanced functions? The help shows you how to create an add-in, and the rest of the help describes the object model pretty well - including examples for specific functions. Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009 |
| |||
| Mappoint HTML
Does this help? <html> <head> <meta http-equiv=Content-Type content="text/html; charset=windows-1252"> <title>Prospect Map</title> <SCRIPT LANGUAGE="VBScript"> <!-- Sub initMap() MappointControl1.NewMap 1 MappointControl1.Toolbars.Item(1).Visible = true MappointControl1.Toolbars.Item(2).Visible = true MappointControl1.Toolbars.Item(3).Visible = true end sub --> </SCRIPT> </head> <body lang=EN-US> <object classid="CLSID:8F78D7FC-BAE4-46A4-A79A-052356AB3DD4" id=MappointControl1 width=600 height=500> <param name=BorderStyle value=0> <param name=MousePointer value=0> <param name=TabStop value=-1> <param name=Appearance value=1> <param name=PaneState value=0> <param name=Units value=0> </object> </p> <SCRIPT LANGUAGE="VBScript"> Dim addrSize Dim str, city, state, zip initMap() Set mp = MappointControl1.ActiveMap Dim addrList(3) addrSize = 3 addrList(0) = "16911 N Triple Butte Court,Colbert,WA,99005" addrList(1) = "2000 Gold Cup Mountain Road,Priest River,ID,83856" addrList(2) = "7640 E Van Buren Avenue,Port Orchard,WA,98366" addrList(3) = "4308 S Conklin Road,Greenacres,WA,99016" pinCount = 0 On Error Resume Next for ii=0 to addrSize Set sa = mp.ParseStreetAddress(addrList(ii)) Set rs = mp.FindAddressResults(sa.Street, sa.City, , sa.Region, sa.PostalCode, 244) if rs.ResultsQuality = 1 then pinCount = pinCount + 1 mp.AddPushpin rs.Item(1),rs.Item(1).Name Set pp = mp.FindPushPin(rs.Item(1).Name) pp.Symbol = 17 if pinCount = 1 then rs.Item(1).GoTo end if end if next MappointControl1.ActiveMap.Saved = true </SCRIPT> </body> </html> |
| |||
|
hi richard, Quote:
Can you post example of it?
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| ||||
|
I was trying to find out what the required advanced functions were. Milo had already found the instructions for creating an add-in but wanted more. For the record, the add-in documentation (ie. instructions for creating a VB6 add-in): Create COM add-ins in Visual Basic With Microsoft Visual Basic version 6.0, you can use the same Add-In Designer to build a COM add-in that you would use to build a Visual Basic 6.0 add-in. This designer wraps the IDTExtensibility2 interface so that you do not have to implement it yourself. It also registers your add-in for you. Note To create a single add-in that works with multiple Office applications, you must use the Visual Basic Implements statement when creating add-ins, because the Visual Basic Add-In Designer does not support multiple host applications in one .dll file. Start Visual Basic 6.0, and on the New tab, click Addin, and then click Open. A designer class (Connect) and a form (frmAddIn) are added to your project. Note If the New Project dialog box doesn't appear when you first start Visual Basic, on the File menu, click New Project. In the Project window, expand the Designers folder under MyAddIn, and then double-click Connect. In the Application box, click Microsoft MapPoint, and then in the Application Version box, click either Microsoft MapPoint 9.0 (version 2002) or Microsoft MapPoint 11.0 (version 2004). In the Initial Load Behavior box, click Startup, and then close the Add-In Designer by clicking the Close button. On the Project menu, click References, select the check box next to Microsoft MapPoint 9.0 Object Library or Microsoft MapPoint 11.0, and then click OK. In the Project window, right-click Connect, and then click View Code. Select all the code in the Code window, and press DELETE. That code was designed for and works with Visual Basic add-ins, not Office COM add-ins. Add the following code: Code: Option Explicit
Public m_formDisplayed As Boolean
Public g_oApp As Mappoint.Application
Dim m_frmAddIn As New frmAddIn
Sub Hide() '--Hides the form and remembers its state
On Error Resume Next
m_formDisplayed = False
m_frmAddIn.Hide
End Sub
Sub Show()'--Shows the form and remembers its state
On Error Resume Next
If m_frmAddIn Is Nothing Then
Set m_frmAddIn = New frmAddIn
End If
Set m_frmAddIn.g_oApp = g_oApp
Set m_frmAddIn.Connect = Me
m_formDisplayed = True
m_frmAddIn.Show vbModal
End Sub
'------------------------------------------------------
'This method adds the add-in to MapPoint
'------------------------------------------------------
Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As Object, custom() As Variant)
On Error GoTo error_handler
'Save the MapPoint instance
Set g_oApp = Application
'--The following has the name of the menu item that is added:
g_oApp.AddCommand "MapPoint Addin...", "Show", Me
If ConnectMode = ext_cm_AfterStartup Then
If GetSetting(App.Title, "Settings", "DisplayOnConnect", _
"0") = "1" Then
'Set this to display the form on connect
Me.Show
End If
End If
Exit Sub
error_handler:
MsgBox Err.Description
End Sub
'------------------------------------------------------
'This method removes the add-in from MapPoint
'------------------------------------------------------
Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode As AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
On Error Resume Next
'Delete the commands that were added for this add-in
g_oApp.RemoveCommands Me
Unload m_frmAddIn
Set m_frmAddIn = Nothing
End Sub
Remove the following code: Code: Public VBInstance As VBIDE.VBEand Private Sub OKButton_Click() MsgBox "AddIn operation on: " & VBInstance.FullName End Sub Code: Public g_oApp As Mappoint.Application On the File menu, click Save, and then save the project. On the File menu, click Make MyAddIn.dll. The designer automatically registers the add-in for you. Start MapPoint, and on the Tools menu, click MapPoint AddIn. A blank form opens. Notes The following code from this sample is specific to MapPoint: In the OnConnection event, the following line of code tells MapPoint to add a "MapPoint Addin..." menu item to the Tools menu: Code: g_oApp.AddCommand "MapPoint Addin...", "Show", Me The third parameter is a reference to the object (in this case the Connect designer) that has the Show method. You could add multiple menu items with their own handlers by calling this method again. In the OnDisconnection event, the following line of code removes any commands that have been added by this add-in: Code: g_oApp.RemoveCommands Me [/code]
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009 |
| |||
|
Hi Richard, thanks for this splendid explanation. I finally understeand something of this matter
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Re: Mappoint HTML Quote:
|
![]() |
| Tags |
| addin, mappoint |
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 failed to load | satrapu | MapPoint 2006/2009 Discussion | 0 | 11-03-2005 03:40 AM |
| Registration of AddIn for mappoint 2004 | fattystud69 | MapPoint 2006/2009 Discussion | 0 | 09-19-2005 10:08 AM |
| Create Addin application for Mappoint | Anonymous | MapPoint 2006/2009 Discussion | 2 | 01-14-2004 04:51 AM |
| Mappoint addin with Delphi 6 | jeanluc | MapPoint 2006/2009 Discussion | 2 | 09-15-2003 03:03 PM |
| I am attempting to write a com addin for mappoint .... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 03-14-2001 10:44 AM |