Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating a .dll to act like COM, add in for ESRI application

Status
Not open for further replies.

virtualforester

Programmer
Joined
Jan 5, 2005
Messages
2
Location
CA
I have a problem creating a .dll that acts like an activeX dll. I am creating an add-in for ESRI ArcMap. I can create the .dll add-in using VB.NET in Visual Studio 2003. The project builds and works fine on the machine it is developed on. The same reference libraries exist on the deployment machine. When I move to deployment the .dll can't be registered. Anyone know why?

Thanks,

The Virtual Forester
 
A quick easy thing to check, does the target machine have the correct version of .Net Framework installed?

-Rick

----------------------
 
Yes. Both machines have the same framework. Here is my code.

Imports System.Runtime.InteropServices
Imports System.Windows.Forms
Imports System.Drawing
Imports System.IO
Imports System.Text
Imports ESRI.ArcObjects.Core
Imports ESRI.ArcObjects.Samples.BaseClasses
Imports ESRI.ArcObjects.Samples.CatIDs

<ComClass(AirphotoLoad.ClassId, AirphotoLoad.InterfaceId, AirphotoLoad.EventsId)> _
Public NotInheritable Class AirphotoLoad
Inherits BaseCommand

#Region "COM GUIDs"
Public Const ClassId As String = "1A0A82AA-5748-4C4E-845D-43CD01A13E67"
Public Const InterfaceId As String = "D7FADFE2-077C-453C-9A67-AA16BC8B5F23"
Public Const EventsId As String = "1807E736-85BB-47D2-A2CB-75462E685E4E"
#End Region
#Region "Register Unregister Component"
<ComRegisterFunction(), ComVisible(False)> _
Public Shared Sub OnRegister(ByVal regKey As String)
MxCommand.Register(regKey)
End Sub

<ComUnregisterFunction(), ComVisible(False)> _
Public Shared Sub OnUnRegister(ByVal regKey As String)
MxCommand.Unregister(regKey)
End Sub
#End Region
Private m_app As IApplication
Public Sub New()
MyBase.New()
m_caption = "Caption Description"
m_category = "Tool Category"
m_message = "Sample Tool Message"
m_name = "ToolName"
m_tooltip = "Sample Tool tip"
m_bitmap = New Bitmap(Me.GetType.Assembly.GetManifestResourceStream("ESRISamples.happy2.bmp"))

End Sub
Public Overrides Sub OnClick()
' Add some code to do some action when the command is clicked. In this
' example, a message box is displayed.
ButtonClick()
End Sub
Public Overrides Sub OnCreate(ByVal hook As Object)
If TypeOf hook Is IMxApplication Then
m_app = hook
End If
End Sub
Public Overrides ReadOnly Property Enabled() As Boolean
Get
' Add some logic here to specify in what state the application
' should be in for the command to be enabled. In this example,
' the command is enabled only when there is at least one data
' layer loaded in ArcMap.
Dim mxDoc As IMxDocument
Dim layerCount As Integer
mxDoc = m_app.Document
layerCount = mxDoc.FocusMap.LayerCount
If layerCount > 0 Then
Enabled = True
Else
Enabled = False
End If
End Get
End Property
Public Overrides ReadOnly Property Checked() As Boolean
Get

End Get
End Property
End Class
Public Sub ButtonClick()
msgbox ("buttonCLicked")
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top