OK, I've implemented events using two different methods, and in neither case have I been able to actually receive events. I'm hoping somebody else has tried and can help.
First way...
Using my existing plugins (ATL dll with ATL control) implemented the IMJAutomationEvents interface using IDispatchImpl and exposed the interface in the COM_INTERFACE_MAP. Advising the source recieves an S_OK result and a valid cookie. No events are received. I think perhaps this one is a problem with dual IDispatchImpl interfaces (one for the main interface and one for the event sink). I tried using CMulitDispatch from The Code Project (and based on my testing it seemed to work fine because I could expose only the IMJAutomationEvents version of IDispatch, but the Init function in the main interface would still be run) but still no events received by the handler function.
As a side note, the standard way to start an interface plugin is to use a composite control, but doing that means you can't use the SINK_MAP to set up your event handlers. This is due to the fact that the composite control advises the sinks automatically upon activation of the control and since there is not a window yet, this fails for the event that needs to hook to MC because it hasn't attached to it yet.
So I went on to the second way...
I implemented a plain interface plugin using MFC (ActiveX control) and followed the steps in the Wiki to expose the IMJAutomationEvents interface in the interface map, set up the Dispatch map to point to the right function, etc. Advising the source yields a valid result and cookie. Yet, still no events recieved by the handler function.
So here's my questions...
Does MC log when it fires events? I turned on logging in MC, but can't tell if I should be receiving anything or not. I only have one zone, I'm changing the playlist, skipping files, etc. to try to generate events.
As far as I know, everyone else has implemented functions using VB or Delphi, but has anyone (successfully) implemented events using C++ (either ATL or MFC) ??
I can email the source to anyone who wants to take a look. It's in VC2003 (7.1).