Within an MFC DLL I have a CCmdTarget derivative that is used as an Automation client (i.e. using AfxConnectionAdvise() to sink it up with the given interface). The problem is it never receives any events. I have cut+pasted this class into a MFC CDialog-based project. It worked just fine.

DLL:
I've noticed that when I call Release() on my IEventHandler interface, I get a DEBUG ASSERT in atlwin.h
("ATL: ERROR - Object deleted before window was destroyed").


What do I have to do to use an Automation client within an MFC DLL?? Anything special? Anybody have source code? Microsoft has examples that have clients within .exes.

Help!