HRESULT hres;

       DWORD d;

       IConnectionPoint * icp;

       IConnectionPointContainer * icpc;

       hres = iITunes->QueryInterface(IID_IConnectionPointContainer,(PVOID *)&icpc);

       hres = icpc->FindConnectionPoint(DIID__IiTunesEvents,&icp);

       eventSink = new ITunesEventSink();

       hres = icp->Advise((IUnknown*)&eventSink,&d);


Then change that Invoke() method to respond to the following events:


TEventDatabaseChanged 

(1) iTunes database has changed

ITEventPlayerPlay 

(2) a track has started playing

ITEventPlayerStop 

(3) a track has stopped playing

ITEventPlayerPlayingTrackChanged 

(4) information about the currently playing track has changed

ITEventCOMCallsDisabled 

(6) calls to the iTunes COM interface will be deferred (typically because a modal dialog is displayed)

ITEventCOMCallsEnabled 

(7) calls to the iTunes COM interface will no longer be deferred (typically because the last modal dialog has been dismissed)

ITEventQuitting 

(8) iTunes is about to quit, existing iTunes COM objects will no longer be valid

ITEventAboutToPromptUserToQuit 

(9) iTunes is about to prompt the user to quit, you should release iTunes COM objects if you want to avoid the dialog

ITEventSoundVolumeChanged 

(10) the sound output volume has changed


Have fun!