views:

330

answers:

1

on DISPID_DOCUMENTCOMPLETE if I am attaching an onclick handler for a particular element in the DOM from a worker thread, then the event is not getting fired while clicking it, what might be the reason? this is working fine if I am attaching event handler from the main thread, but I want to do things asynchronously.

I am using CoMarshalInterThreadInterfaceInStream and CoGetInterfaceAndReleaseStream to pass IID_IWebBrowser2 pointer between threads.

+1  A: 

What is your worker thread doing, and what is the threading model of the event handler? If the threading model is STA, then the worker thread needs to either periodically pump messages, or if it is waiting for synchronisation then it should use the CoWaitFor... functions, to make sure that COM messages will be processed. Or, you can aggregate the free threaded marshaller, but make sure your object is thread safe, and does not call out to any other COM interfaces that might give you a threading model error if you do this.

Probably, the web browser control is not compatible with the MTA, so you will not be able to place it in that. In any case, the MTA is not compatible with a user interface thread so that rules that out.

1800 INFORMATION