views:

23

answers:

1

Adam Nathan in his book ".NET and COM" demonstrates how to hook up events from a C# library to a COM client, but the client code is shown only with a VB sample--I need C++.

The C# client implements the Phone class:

[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IPhoneEvents
{
  [Dispid(1)] void Ring();
}

public delegate void RingEventHandler();

[ComSourceInterfaces(typeof(IPhoneEvents)]
public class Phone
{
  public event RingEventHandler Ring;
  ...
}

The VB client looks like this:

Private WithEvents myPhone As Phone
Private Sub IPhoneEvents_Ring()
...
End Sub

I need to do what the VB class is doing but with unmanaged C++, but I can't find any good samples. Can anyone point me in the right direction?

TIA

A: 

This article may help: http://msdn.microsoft.com/en-us/magazine/cc163659.aspx

Kristopher Johnson