1

I've been trying to implement a connection point sink for a third party COM component using MFC. I've developed some COM components before, though connection point sinks is not something I'm well versed in. After banging my head against a wall for a while, I decided to go back to basics and found this Microsoft example:

https://support.microsoft.com/en-us/kb/183599

It seemed the most similar to what I'm trying to do. I attempted to reproduce the example exactly as described. Although my MS Word version is 2010, the referenced interfaces still appear to be valid. I dutifully followed the instructions, literally cutting and pasting the code into my own project and only having to make adjustments for wide character strings. After compile, I can launch the word app and quit it, but I don't receive the connection point events, which after all was the whole point. I thought perhaps the problem was with the function dispid, so I attempted to add DISP_FUNCTION_ID entries into the Dispatch Map; but that just leads to an assertion on oledisp1.ccp line 549 which turns out to be in the CCmdTarget::GetStackSize function.

I'm sure this is dumb simple, but I just can't get it to work. Can somebody please help me figure out what is missing from the example? Thanks.

forother
  • 39
  • 4
  • If you're having difficulty understanding COM connection points, you should read [An introduction to COM connection points](http://blogs.msdn.com/b/oldnewthing/archive/2013/06/12/10424940.aspx). Also potentially relevant here is [Dispatch interfaces as connection point interfaces](http://blogs.msdn.com/b/oldnewthing/archive/2013/06/12/10425215.aspx). – IInspectable Jun 21 '15 at 16:30
  • Not having trouble understanding connection point concepts. I'm having trouble getting it to work using recommended MFC approach whereby a CCmdTarget derived class is used to implement the sink interface. It seems straight forward, the example makes perfect sense to me, it just doesn't work. – forother Jun 21 '15 at 19:09

1 Answers1

1

Figured it out. I was on the right track adding the DISP_FUNCTION_ID macros to my Dispatch map, however I had stupidly used VT_VOID instead of VT_EMPTY which was caused the runtime assertion.

forother
  • 39
  • 4