Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / November 2004

Tip: Looking for answers? Try searching our database.

Howto sink VB.NET event in VC6 class?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ulrik - 16 Nov 2004 15:11 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.