Using CComCreator

Easiest way to construct a COM interface from it’s co class. [sourcecode language=’cpp’]ISomeInterfacePtr sipPtr; HRESULT hRes = CComCreator< CComObject< CSomeCoClass > >::CreateInstance( 0, IID_ISomeInterface, reinterpret_cast( void**, &sipPtr )); ASSERT( SUCCEEDED( hRes ));[/sourcecode] Must be an ATL/COM Project.
Continue reading…