1

I have a legacy Win32 application (WndProcs, etc) that needs to consume a COM object. With the use of a little ATL headers and some smart pointers that was a snap, however what I'm currently struggling with is how best to sink the events coming off that COM object?

My current working plan has been to build a second COM object (as a dll) that handles all the sinking and uses windows messages to communicate with the legacy application. This is "ok" but there's a lot of cruft moving messages back and forth to make the legacy application do what I want.

Is there a readily accessible way to get the Win32 legacy application to sink COM events directly vs running through the second "sinker" com object?

Before I go to far down this process I wanted to see if anyone else ran across this before and had a working solution.

Thanks!

4
  • 1
    "...to sink COM events directly..." : where ? A connection point design requires an interface pointer to which it sends its events after said-interface is registered via a call to Advise(). That's how connection points work. If you're asking whether you have to implement the COM object on which that event target interface hangs as a DLL-based inproc server, the answer is no, but you need an interface regardless. How you provide that interface is entirely up to you. Commented Aug 29, 2014 at 12:41
  • ATL IDispEventImpl accepts "typical" ActiveX control events delivered via connection points and IDispatch::Invoke. Commented Aug 29, 2014 at 13:37
  • What compiler is being used for the legacy application? Commented Aug 30, 2014 at 21:32
  • Microsoft Visual Studio 2008 Commented Aug 31, 2014 at 20:48

1 Answer 1

4

Stumbled across this excellent write up by the always brilliant Raymond Chen.

http://blogs.msdn.com/b/oldnewthing/archive/2013/06/12/10425215.aspx

As WhozCraig indicated above, all I needed was the Interface pointer and to setup the Advise, handle the Invoke.

Nice and clean.

Thanks!

Sign up to request clarification or add additional context in comments.

1 Comment

This helped a lot. Thank you. I was actually quite close, but didn't know what to do with the other functions in IDispatch. Turns out. Nothing! ^^

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.