开发者

.NET events to C++ COM client

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 samp开发者_如何学Pythonles. Can anyone point me in the right direction?

TIA

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜