1

I am trying to handle COM events from a C# server to a C++ client. I am able to use the server regfree but my events no longer work.

Previously, with registration, the events were handled in the client via IDispEventImpl from the ATL.

I haven't been able to find any articles directly addressing this but I did see a suggestion that IConnectionPoint does not inherently require registration.

I also saw some suggestion that IDispEventSimpleImpl may work regfree.

patthoyts
  • 32,320
  • 3
  • 62
  • 93
Fredrick
  • 1,210
  • 2
  • 15
  • 24

1 Answers1

2

IDispEventImpl requires access to a type library. You'll need to include a reference in your server manifest, so that it can be loaded into the activation context:

<file name="mydll.tlb">
    <typelib
        tlbid="{TLBID}"
        version="1.0"
        helpdir=""
        flags="hasdiskimage"/>
</file>

Your client sink needs to be declared with the typelib ID as well:

class CMySink: public IDispEventImpl<1, CMySink, &IID_IEvent, &TLBID, 1, 0>

As an alternative, you can also implement IDispEventSimpleImpl, which works without a type library.

Aurora
  • 1,334
  • 8
  • 21