Where AddRef and Release don't do anything and QueryInterface fails on every attempt. (meaning it sets *ppvObject to NULL and returns S_FALSE).
The rest of the class is comprised of the implementation of another COM interface namely ITextHost. Now I'm creating a COM object that takes an ITextHost interface as a parameter. Is it OK to pass it static_cast<ITextHost*>(this) ?
My C++ class does not need to be a creatable COM object. It only needs to be called through COM once it has been created. It is not supposed to be derived from IDispatch, but only from IUnknown (hence QueryInterface, AddRef and Release)
My guess is that I should at least allow QueryInterface to succeed for IUnknown and ITextHost.
BUT, provided this, is this really supposed to work ? It does work in my example code (on my machine), but it seems a bit dodgy.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.