MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth Users and Developers




mappoint addin

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


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 02-15-2005
Junior Member
White Belt
 
Join Date: Oct 2004
Posts: 10
Send a message via MSN to Milo Send a message via Yahoo to Milo
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
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 02-15-2005
Winwaed's Avatar
Mapping-Tools.com
Black Belt
 
Join Date: Feb 2004
Posts: 1,142
Blog Entries: 22
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
See the Geoweb Guru for online mapping
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 02-15-2005
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
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>
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 02-15-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,177
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?
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 02-15-2005
Winwaed's Avatar
Mapping-Tools.com
Black Belt
 
Join Date: Feb 2004
Posts: 1,142
Blog Entries: 22
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
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()
	MsgBox "AddIn operation on: " & 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
See the Geoweb Guru for online mapping
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 02-16-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,177
Hi Richard, thanks for this splendid explanation. I finally understeand something of this matter
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 08-16-2005
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!!!
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, mappoint


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 failed to load satrapu MapPoint 2006/2009 Discussion 0 11-03-2005 02:40 AM
Registration of AddIn for mappoint 2004 fattystud69 MapPoint 2006/2009 Discussion 0 09-19-2005 09:08 AM
Create Addin application for Mappoint Anonymous MapPoint 2006/2009 Discussion 2 01-14-2004 03:51 AM
Mappoint addin with Delphi 6 jeanluc MapPoint 2006/2009 Discussion 2 09-15-2003 02:03 PM
I am attempting to write a com addin for mappoint .... Anonymous MapPoint 2006/2009 Discussion 1 03-14-2001 09:44 AM


All times are GMT -5. The time now is 11:00 PM.


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

Larnaca Holiday
Take a Larnaca holiday through UlookUbook and enjoy beautiful seaside resorts and sandy beaches.



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