Hi Jerry,
Do you mean that after you added the ProgId attribute, the oleview is no
longer able to view the type library? Does the type library work when
referenced by VB6 project?
Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
JerryWEC - 26 Jan 2007 17:08 GMT
Walter,
Yes, I'm still getting this error after I added the prog id. I was getting
errors before and after adding the prog id. My current code is below...
<Guid("26014480-5D35-49ed-B83C-1B862BF92517")> _
<InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _
Public Interface ILoggingEvents
<DispId(1)> _
Sub LogExitDisplayLoggingWindow()
<DispId(2)> _
Sub LogErrorOccurred(ByVal outEx As Exception)
End Interface
<Guid("542FA6CF-F2C8-46d3-8601-EF370BBEF146")> _
<InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _
Public Interface ILogging
Property LogToFile() As Boolean
Property LogToScreen() As Boolean
End Interface
#End Region
<Guid("64439B0F-D1BF-43d7-BCD9-BA908BF2CCF6")> _
<ClassInterface(ClassInterfaceType.None)> _
<ProgId("CLA_Logging.Logging")> _
<ComSourceInterfaces(GetType(ILoggingEvents))> _
Public Class Logging
Implements IDisposable
Implements ILogging
Public Delegate Sub LogExitDisplayLoggingWindowHandler()
Public Delegate Sub LogErrorOccurredHandler(ByVal outEx As Exception)
Public Event LogExitDisplayLoggingWindow As
LogExitDisplayLoggingWindowHandler
Public Event LogErrorOccurred As LogErrorOccurredHandler
Public Sub New()
Try
If m_formInstance Is Nothing Then
m_formInstance = New frmLogDisplay()
m_formInstance.ParentLogging = Me
End If
Catch ex As Exception
ProcessException(ex)
End Try
End Sub
Public Property LogToFile() As Boolean Implements ILogging.LogToFile
Private Get
Try
Return m_LogToFile
Catch ex As Exception
ProcessException(ex)
End Try
End Get
Set(ByVal value As Boolean)
Try
m_LogToFile = value
Catch ex As Exception
ProcessException(ex)
End Try
End Set
End Property
Public Property LogToScreen() As Boolean Implements ILogging.LogToScreen
Private Get
Try
Return m_LogToScreen
Catch ex As Exception
ProcessException(ex)
End Try
End Get
Set(ByVal value As Boolean)
Try
m_LogToScreen = value
Catch ex As Exception
ProcessException(ex)
End Try
End Set
End Property
'*** Other code not shown.
End Class
Great Links:
(Part 1)
http://www.15seconds.com/issue/040721.htm
(Part 2)...
http://www.15seconds.com/issue/060309.htm
http://www.codeproject.com/dotnet/cominterop.asp
...(See Part 2)
Yes Walter I am all over the place on this COM InterOp topic. It would be
nice to have one good source of docuemntation and code examples of how to
use these attributes and when and where each one is needed, etc... It still
blows my mind that I can't inherit from a base class and for my derived
class see my public methods, properties and event when exposed via COM
Attributes. Maybe after I have a working module of the proper and best way
to do COM InterOp I a can explore the "Inheritance Option".
* See newest post named: "COM InterOp - Interace ?s" for continued
descussion's on this topic.
Thanks! JerryM
Walter Wang [MSFT] - 29 Jan 2007 09:24 GMT
Hi Jerry,
Using your code from your other post:
Imports System
Imports System.Runtime.InteropServices
Imports System.Runtime
<Guid("26014480-5D35-49ed-B83C-1B862BF92517")> _
<InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _
Public Interface ILoggingEvents
<DispId(1)> _
Sub LogExitDisplayLoggingWindow()
<DispId(2)> _
Sub LogErrorOccurred(ByVal outEx As Exception)
End Interface
<Guid("542FA6CF-F2C8-46d3-8601-EF370BBEF146")> _
<InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _
Public Interface ILogging
Property LogToFile() As Boolean
Sub Log(ByVal text As String)
End Interface
<Guid("64439B0F-D1BF-43d7-BCD9-BA908BF2CCF6")> _
<ClassInterface(ClassInterfaceType.None)> _
<ProgId("CLA_Logging.Logging")> _
<ComSourceInterfaces(GetType(ILoggingEvents))> _
Public Class Logging
Implements ILogging
Implements IDisposable
Public Delegate Sub LogExitDisplayLoggingWindowHandler()
Public Delegate Sub LogErrorOccurredHandler(ByVal outEx As Exception)
Public Event LogExitDisplayLoggingWindow As
LogExitDisplayLoggingWindowHandler
Public Event LogErrorOccurred As LogErrorOccurredHandler
Private m_LogToFile As Boolean
Public Sub New()
End Sub
Public Property LogToFile() As Boolean Implements ILogging.LogToFile
Private Get
Return m_LogToFile
End Get
Set(ByVal value As Boolean)
m_LogToFile = value
End Set
End Property
Public Sub Log(ByVal text As String) Implements ILogging.Log
If String.IsNullOrEmpty(text) Then
Throw New ArgumentException("text cannot be empty")
End If
End Sub
Public Sub Dispose() Implements IDisposable.Dispose
End Sub
End Class
The generated .tlb file loads correctly by OleView.
Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
JerryWEC - 31 Jan 2007 18:56 GMT
Walter, yes I understand that you have this working. I may have some thing
missing on my workstation. I'm still getting the same errors.
If anyone else has seen these errors please let me know so I can fix this on
my machine.
TIA, JerryM