Thanks to the FireBreath contributor from Japan, we finally got the solution.
The first thing is that the COM object should be registered as "Apartment", and not "Single" (in the registry). Otherwise this will not work; seems to be a bug in COM.
Then after calling SetClientSite you can do the following:
CComQIPtr<IOleControlSite> site(m_spClientSite); CComPtr<IDispatch> dispatch; site->GetExtendedControl(&dispatch); CComQIPtr<IHTMLElement2> htmlElement = dispatch;
Hope this helps someone; It took me almost 2 years to find someone who could answer this for me.
The object in the htmlElement will be the <object> tag that wraps your plugin; therefore, if you request an interface for any of your interfaces, it should succeed, but in reality it cannot be literally your object, most likely it will be a wrapper for your object.
source share