c++comconnection-points

regenerating connection point methods


I've created a connection point interface _IPlayerEvents.

I've added a couple of methods

OnConnect()
OnDisconnect()

I've built the project, and VS2008 has generated code in the CProxy_IPlayerEvents class:

HRESULT Fire_OnConnect(){...}
HRESULT Fire_OnDisconnect() {...}

Now I've added a further method to the _IPlayerEvents interface

OnMessage([out, retval]BSTR* pbstrMessage)

When I build, no code is added to the CProxy_IPlayerEvents class for the OnMessage function - I'd expected that VS2008 would generate:

HRESULT Fire_OnMessage(BSTR* pbstrMessage){...}

I'd prefer to avoid having to update the CProxy_IPlayerEvents manually if I could.

How can I force VS2008 to regenerate the CProxy_IPlayerEvents class?


Solution

  • I found an answer!

    Open Class View in VS2008, right-click your COM object and from its context menu, select Add -> Add Connection Point... Move the source interface from the list on the left over to the right, then click Finish.

    This will generate or regenerate proxy class when you next build your project.

    This step is crucial - and a real pain if you haven't done connection points in a while!