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
Results 1 to 7 of 7

mappoint addin

This is a discussion on mappoint addin within the MapPoint Desktop 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 ...

  1. #1
    Milo is offline Junior Member White Belt
    Join Date
    Oct 2004
    Posts
    10

    mappoint addin

    Im trying to create an addin for mappoint using vb and need some sort of tutorial or if someone has an example for them to send me it. I have tried the HTML help that is with mappoint but this tells you how to create one, not for advanced functions.

    Thanks
    Milo
    =========
    Milo

  2. #2
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60
    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

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

    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>

  4. #4
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    hi richard,

    Quote Originally Posted by Winwaed
    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.
    This does not answer the original poster his question, but in fact I do not understeand these 'add in's'

    Can you post example of it?

  5. #5
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60
    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&#40;&#41; '--Hides the form and remembers its state
        On Error Resume Next
        m_formDisplayed = False
        m_frmAddIn.Hide
    End Sub
    
    Sub Show&#40;&#41;'--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&#40;ByVal Application As Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As Object, custom&#40;&#41; As Variant&#41;
        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&#58;
        g_oApp.AddCommand "MapPoint Addin...", "Show", Me
        If ConnectMode = ext_cm_AfterStartup Then
            If GetSetting&#40;App.Title, "Settings", "DisplayOnConnect", _
                  "0"&#41; = "1" Then
                'Set this to display the form on connect
                Me.Show
            End If
        End If
        Exit Sub
        
    error_handler&#58;
        MsgBox Err.Description
    End Sub
    
    '------------------------------------------------------
    'This method removes the add-in from MapPoint
    '------------------------------------------------------
    Private Sub AddinInstance_OnDisconnection&#40;ByVal RemoveMode As AddInDesignerObjects.ext_DisconnectMode, custom&#40;&#41; As Variant&#41;
        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
    In the Project window, right-click the frmAddIn item, and click View Code.
    Remove the following code:

    Code:
    Public VBInstance As VBIDE.VBEand
    
    Private Sub OKButton_Click&#40;&#41;
    	MsgBox "AddIn operation on&#58; " & VBInstance.FullName
    End Sub
    In the general declarations part of the form, add a declaration for the MapPoint application as follows:

    Code:
    Public g_oApp As Mappoint.Application
    This gives the add-in a reference to the proper instance of MapPoint in case there is more than one.

    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
    When that menu item is called, the method indicated in the second parameter (in this case the Show method) is called.

    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
    Give your project a unique name by clicking MyAddInProperties on the Project menu, and then in the Project Name box, typing the name of your add-in. If you also change the name of the designer from Connect, remember to update the code that references it.

    [/code]
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

  6. #6
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi Richard, thanks for this splendid explanation. I finally understeand something of this matter

  7. #7
    1.21Gigawatts is offline Junior Member White Belt
    Join Date
    Apr 2005
    Posts
    8

    Re: Mappoint HTML

    Quote Originally Posted by RobC
    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>
    What's really cool is this is exactly what I was looking for!!!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. MapPoint Addin failed to load
    By satrapu in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 11-03-2005, 03:40 AM
  2. Registration of AddIn for mappoint 2004
    By fattystud69 in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 09-19-2005, 10:08 AM
  3. Create Addin application for Mappoint
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 01-14-2004, 04:51 AM
  4. Mappoint addin with Delphi 6
    By jeanluc in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 09-15-2003, 03:03 PM
  5. I am attempting to write a com addin for mappoint ....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-14-2001, 10:44 AM

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