How do I talk to HTML from a worker thread in an ATL ActiveX control?
Posted on 2001-07-16
HRESULT hr = m_spClientSite->QueryInterface(IID_IServiceProvider, (void **)&pISP);
The resultant hr is always 0x8000FFFF. As such, I can't drill down to find the IHTMLWindow2 interface, upon which I'd like to call execScript(...).
If I make this function call from the UI thread, everything is OK, but thats not what I need. I understand that I can pass a message from the worker thread to the UI and have the UI thread make the call for me also, but again, thats not what I need.
I've also tried getting the IHTMLWindow2 interface pointer in the UI thread, then calling CoMarshalInterface on that pointer, then calling CoUnmarshalInterface on that object from the worker thread, but that call fails with a value of 0x8003001e. I'm pretty sure this is the right way to go, I think I'm just doing it wrong.
So what I'm looking for are the steps to create a bare-bones ATL project that creates a worker thread, and that worker thread makes a call to execScript on the IHTMLWindow2 interface from m_spClientSite.
If anyone wants, I'm more than happy to email them the bare-bones project files that I've created so far.