Trouble with Microsoft Word connection point sink example / MFC

138 Views Asked by At

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.

1

There are 1 best solutions below

0
forother On

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.