May 302007
 

Easiest way to construct a COM interface from it’s co class.

ISomeInterfacePtr sipPtr;
HRESULT hRes =
CComCreator< CComObject< CSomeCoClass > >::CreateInstance( 0,
                                                           IID_ISomeInterface,
                                                           reinterpret_cast( void**, &sipPtr ));

ASSERT( SUCCEEDED( hRes ));

Must be an ATL/COM Project.