Original Post
Okay. I'm haveing a separate class for implementing each of my components like this...
I1 -> CImpI1
I2 -> CImpI2
I3 -> CImpI3
.
.
.
In -> CImpIn
... and I want the QueryInterface function for each interface to support all the other interfaces, like a good little component should. Well, I'm not sure if the standard way I do QueryInterface would work right for this:
I'm not sure if this would cause errors since the interfaces are in separate classes, or if the classes have anything to do with it whatsoever. Thanks in advance.
Edited by - Exellon2000 on January 2, 2002 5:49:26 PM
Edited by - Exellon2000 on January 2, 2002 5:50:14 PM
Edited by - Exellon2000 on January 2, 2002 8:08:48 PM
HRESULT CImp_IX :: QueryInterface ( const IID& iid, void** ppv )
{
if ( iid == IID_IUnknown )
{
*ppv = static_cast < IX* > ( this ) ;
}
else if ( iid == IID_IX )
{
*ppv = static_cast < IX* > ( this ) ;
}
else if ( iid == IID_IY )
{
*ppv = static_cast < IY* > ( this ) ;
}
else if ( iid == IID_IZ )
{
*ppv = static_cast < IZ* > ( this ) ;
}
else
{
*ppv = NULL ;
return ( E_NOINTERFACE ) ;
}
reinterpret_cast < IUnknown* > ( *ppv ) -> AddRef ( VOID ) ;
return ( S_OK ) ;
}
|