NeroCOM events in C , please some advice

vbimport

#1

Hi, i’m trying to use NeroCOM in plain C, everything seems to work except events, basically i’m doing this

i query the IConnectionPointContainer in the Nero object

i use FindConnectionPoint of IConnectionPointContainer to get the ConnectionPoint of INeroEvents

i use Advise with the ConnectionPoint with a COM object of my own that exposes INeroEvents

Advise returns Ok but events don’t get fired, only QueryInterface is fired asking for IID__INeroEvents

Is this the correct way?, what i’m doing wrong?


#2

It looks pretty ok. What process have you started in order to expect any event? What exact event were you expecting? How are you expecting it? If everything is ok, your Invoke() method should get called with the proper DISPID and with the event arguments packed in DISPPARAMS.


#3

Thanks for helping, i’m trying to port the NeroFiddlesCOM example. i’m expecting the events that would fire in the Burn_Click() sub in the vb example, i’m doing exactly the same, the CD track is burned but events aren’t triggered

i have some clues of what may be wrong, when the QueryInterface() of my sink object is called i can only identify requests for IID_IUnknown and IID__INeroEvents but then it requests for other iids that i don’t know what they are, so i’m returning #E_NOINTERFACE for those. So what are those interfaces i’m supposed to handle?

also i have another sink object for the _INeroDriveEvents


#4

Pardon me if I am misinterpreting it, but it seems to me that you define an arbitrary function with a name of Burn_Click() and expect it to magically become an event handler. You cannot do this. Your _INeroEvents implementation should handle events in IDispatch::Invoke() method by doing a switch on various DISPIDs of interest. It is a very tedious work to do in straight C, although not impossible.

You must also recognize at least IID_IDispatch along with IID_IUnknown and IID__INeroEvents.

Although this is all doable in C, I cannot believe someone would actually try it. If you consider to take a suggestion and move to straight NeroAPI, things might get a whole lot easier for you. Depending on the level of complexity of your app, NeroAPI could be a better choice as you would avoid ugly COM handling in C. AddRef-ing and Release-ing all those interface pointers manually is simply a disaster waiting to happen.