![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm trying to write a COM Object in VB .NET and not having the best of luck. I'm not 100% sure that I have the Code writen properly to expose the methods in my object or if I'm just not registering the dll properly on the Target machine. I've included the Code for the Object below. Does it Look fine? I then register it on the Target machine with the following: regasm comMyCom.dll /tlb:comMyCom.tlb /codebase gacutil /i comMyCom.dll installutil comMyCom.dll regsvcs comMyCom.dll I've tried the above separately in different order nothing seems to work. When I look at the Object in the Component Services Snapin. I do not see the send method for the _comMyCom Interface. I see it for the IcomMyCom interface. What Gives? Any tips would be appreciated! Scott<- -------------------------------------------------------------------------- -- AssemblyInfo.vb -------------------------------------------------------------------------- -- Imports System Imports System.Reflection Imports System.Runtime.InteropServices Imports System.EnterpriseServices Imports System.EnterpriseServices.ActivationOption Imports System.EnterpriseServices.AccessChecksLevelOption ' General Information about an assembly is controlled through the following ' set of attributes. Change these attribute values to modify the information ' associated with an assembly. ' Review the values of the assembly attributes Assembly: AssemblyTitle("ComMyCom") Assembly: AssemblyDescription("") Assembly: AssemblyCompany("E&M Electric, Inc.") Assembly: AssemblyProduct("") Assembly: AssemblyCopyright("2003") Assembly: AssemblyTrademark("") Assembly: CLSCompliant(True) 'The following GUID is for the ID of the typelib if this project is exposed to COM Assembly: Guid("8A4F863A-1CD4-4E8E-942C-912EF1B1D975") '<Assembly: ApplicationAccessControl(True) Assembly: ApplicationAccessControl(True) #Region "COM+ Registration details " 'Supply the COM+ application name Assembly: ApplicationNameAttribute("ComMyCom") Assembly: ApplicationActivation(ActivationOption.Server) 'Supply a strong-name assembly Assembly: AssemblyKeyFileAttribute("..\\..\\comMyCom.snk") #End Region ' Version information for an assembly consists of the following four values: ' ' Major Version ' Minor Version ' Build Number ' Revision ' ' You can specify all the values or you can default the Build and Revision Numbers ' by using the '*' as shown below: Assembly: AssemblyVersion("1.0.*") -------------------------------------------------------------------------- -- comMyCom.vb -------------------------------------------------------------------------- -- Option Explicit On Option Strict On Imports System Imports System.web.mail Imports System.EnterpriseServices Imports System.EnterpriseServices.ActivationOption Imports System.EnterpriseServices.EventTrackingEnabledAttr ibute Imports System.Reflection Imports System.Runtime.InteropServices Imports System.Runtime.InteropServices.ClassInterfaceType Public Interface IcomMyCom Function Send(ByVal strEmailAddress As String, ByVal strEmailServer As String) As Boolean End Interface ' I've tied the three Attributes with all the same results.... '<ComClass(comMyCom.ClassId, comMyCom.InterfaceId, comMyCom.EventsId)> _ 'Public Class comMyCom '<ClassInterfaceAttribute(ClassInterfaceType.AutoD ual)> _ 'Public Class comMyCom TransactionAttribute(TransactionOption.Required)> _ Public Class comMyCom Inherits EnterpriseServices.ServicedComponent Implements IcomMyCom 'Inherits ServicedComponent ' Use the Region directive to define a section named COM Guids. #Region "COM GUIDs" ' These GUIDs provide the COM identity for this class ' and its COM interfaces. You can generate ' these guids using guidgen.exe Public Const ClassId As String = "6983A5C3-6E8A-46d9-90B3-4426BE69588C" Public Const InterfaceId As String = "5203E497-075F-4f6f-9A25-B697A0C38A6D" Public Const EventsId As String = "F871F568-5407-4f34-BF00-1A2BDAEC03F1" #End Region Public Sub New() MyBase.New() End Sub Public Function Send(ByVal strEmailAddress As String, ByVal strEmailServer As String) As Boolean Implements IcomMyCom.Send Send = True End Function End Class |
#3
| |||
| |||
|
|
I'm trying to write a COM Object in VB .NET and not having the best of luck. I'm not 100% sure that I have the Code writen properly to expose the methods in my object or if I'm just not registering the dll properly on the Target machine. I've included the Code for the Object below. Does it Look fine? I then register it on the Target machine with the following: regasm comMyCom.dll /tlb:comMyCom.tlb /codebase gacutil /i comMyCom.dll installutil comMyCom.dll regsvcs comMyCom.dll I've tried the above separately in different order nothing seems to work. When I look at the Object in the Component Services Snapin. I do not see the send method for the _comMyCom Interface. I see it for the IcomMyCom interface. What Gives? Any tips would be appreciated! Scott<- -------------------------------------------------------------------------- -- AssemblyInfo.vb -------------------------------------------------------------------------- -- Imports System Imports System.Reflection Imports System.Runtime.InteropServices Imports System.EnterpriseServices Imports System.EnterpriseServices.ActivationOption Imports System.EnterpriseServices.AccessChecksLevelOption ' General Information about an assembly is controlled through the following ' set of attributes. Change these attribute values to modify the information ' associated with an assembly. ' Review the values of the assembly attributes Assembly: AssemblyTitle("ComMyCom") Assembly: AssemblyDescription("") Assembly: AssemblyCompany("E&M Electric, Inc.") Assembly: AssemblyProduct("") Assembly: AssemblyCopyright("2003") Assembly: AssemblyTrademark("") Assembly: CLSCompliant(True) 'The following GUID is for the ID of the typelib if this project is exposed to COM Assembly: Guid("8A4F863A-1CD4-4E8E-942C-912EF1B1D975") '<Assembly: ApplicationAccessControl(True) Assembly: ApplicationAccessControl(True) #Region "COM+ Registration details " 'Supply the COM+ application name Assembly: ApplicationNameAttribute("ComMyCom") Assembly: ApplicationActivation(ActivationOption.Server) 'Supply a strong-name assembly Assembly: AssemblyKeyFileAttribute("..\\..\\comMyCom.snk") #End Region ' Version information for an assembly consists of the following four values: ' ' Major Version ' Minor Version ' Build Number ' Revision ' ' You can specify all the values or you can default the Build and Revision Numbers ' by using the '*' as shown below: Assembly: AssemblyVersion("1.0.*") -------------------------------------------------------------------------- -- comMyCom.vb -------------------------------------------------------------------------- -- Option Explicit On Option Strict On Imports System Imports System.web.mail Imports System.EnterpriseServices Imports System.EnterpriseServices.ActivationOption Imports System.EnterpriseServices.EventTrackingEnabledAttr ibute Imports System.Reflection Imports System.Runtime.InteropServices Imports System.Runtime.InteropServices.ClassInterfaceType Public Interface IcomMyCom Function Send(ByVal strEmailAddress As String, ByVal strEmailServer As String) As Boolean End Interface ' I've tied the three Attributes with all the same results.... '<ComClass(comMyCom.ClassId, comMyCom.InterfaceId, comMyCom.EventsId)> _ 'Public Class comMyCom '<ClassInterfaceAttribute(ClassInterfaceType.AutoD ual)> _ 'Public Class comMyCom TransactionAttribute(TransactionOption.Required)> _ Public Class comMyCom Inherits EnterpriseServices.ServicedComponent Implements IcomMyCom 'Inherits ServicedComponent ' Use the Region directive to define a section named COM Guids. #Region "COM GUIDs" ' These GUIDs provide the COM identity for this class ' and its COM interfaces. You can generate ' these guids using guidgen.exe Public Const ClassId As String = "6983A5C3-6E8A-46d9-90B3-4426BE69588C" Public Const InterfaceId As String = "5203E497-075F-4f6f-9A25-B697A0C38A6D" Public Const EventsId As String = "F871F568-5407-4f34-BF00-1A2BDAEC03F1" #End Region Public Sub New() MyBase.New() End Sub Public Function Send(ByVal strEmailAddress As String, ByVal strEmailServer As String) As Boolean Implements IcomMyCom.Send Send = True End Function End Class |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |