Re: Interface implementation
Sorry Victor, but about what FAQ you talking? Where can I find it?
Wow, I understand :) sorry.
This is my code. Task is next: I want write template class, CUnknown,
with implemented nessesary methods (Queryinterface, Release ...), to
use it for other classes.
template < class ClassType, REFIID ObjectIID >
class CUnknown : public IUnknown
// IUnknown methods.
virtual STDMETHODIMP QueryInterface( REFIID riid, void** ppv )
if ( ppv == NULL )
if ( riid == *ObjectIID || riid == IID_IUnknown )
*ppv = static_cast< ClassType* >( this );
*ppv = NULL;
virtual STDMETHODIMP_( ULONG ) AddRef()
return InterlockedIncrement( &m_cRef );
virtual STDMETHODIMP_( ULONG ) Release()
LSCOPE( "CMediaBuffer::Release" );
LONG lRef = InterlockedDecrement( &m_cRef );
if ( lRef == 0 )
// m_cRef is no longer valid! Return lRef.
virtual void HandleSMSMessageReceived( const CEOID messageID ) = 0;
// IMAPIAdviseSink also derived from IUnknown
// This is my CUnknown,but anyway "Cannot instantiate abstract
: public virtual CUnknown< CAdviseSinc, IID_IMAPIAdviseSink >
, public virtual IMAPIAdviseSink
ULONG OnNotify( ULONG cNotif, LPNOTIFICATION lpNotifications );
Is that your first day here?
Actually in this group yes, but not in other, I am sorry.