Hi,
I have defined a simple interface in VB.NET:
-----------
Public Interface iBrowser
Function SelectTemplate(ByVal ID As String, ByVal side As Boolean)
As String
Event MatchTemplate(ByVal ID As String)
End Interface
-----------
And a corresponding (dummy) class that implements the interface:
-----------
Public Class Browser
Implements iBrowser
Public Event MatchTemplate(ByVal ID As String) Implements
iBrowser.MatchTemplate
Public Function SelectTemplate(ByVal ID As String, ByVal side As
Boolean) As String Implements iBrowser.SelectTemplate
RaiseEvent MatchTemplate(ID.ToLower)
MsgBox(ID)
End Function
End Class
-----------
I'm using VS.NET 2003 to compile and make the class available for COM
interop. This works fine in the sense that I can create an instance of
the Browser class in VC6 and I can also call the SelectTemplate method
with success.
My problem is that I cannot figure out how to catch the MatchTemplate
event in VC6?
Any hints will be greatly appreciated!
Thanks in advance
Ulrik
Heath Stewart [MSFT] - 21 Nov 2004 08:58 GMT
You need to declare an event source interface using the
ComSourceInterfacesAttribute documented at
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemRuntimeInteropServ
icesComSourceInterfacesAttributeClassTopic.asp.
I wrote an article some time back that may help. It's old and
rudimentary, but explains exposing managed events to COM. Read
http://www.devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=388.

Signature
Heath Stewart
Software Design Engineer
Developer Division Sustained Engineering
Microsoft Corporation