Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SHDocVw.WebBrowser and threads question..
#1
Hi -

I have a dialog which contains a SHDocVw.WebBrowser that I'm using for load testing a third party application. Once I get the MSHTML.IHTMLDocument2 from the browser I sent JavaScript commands in the WM_TIMER block to it like this:
doc.parentWindow.execScript(javaScript "JavaScript")

Everything works well if I open up one of these windows in a 'mac'. If I open two - it also works well. If I open 10 or 20 then things start to break down and I'm not sure if it's a client or server side problem. The client machine isn't under any large load but the windows are extremely sluggish. There are no errors thrown in the console. It appears (but I'm not sure) that JavaScript calls appear to be no-ops or they are timing out. When the next page is loaded (via Navigate()) part of the page may load but it appears that something in the JavaScript thread is on hold.

I can't rule out the server at this point but if I load the web pages on another machine with the same URLs they appear to load just fine.

My questions:
A. Since each of these is running in a separate mac (and thus a separate thread) and are in their own windows - are the SHDocVw.WebBrowser instances independent? Or is there some state that they share? (I'm assuming they share browser cache but nothing more).
B. If there is some shared state - would this be removed if I spawned an external process for each window?

Thanks.
#2
It depends on these components (web browser control, JavaScript engine). Their instances running in separate threads can share everything they want - their global variables, states, data etc.
If they run in separate processes, they have less things to share. Files, registry settings. You know.
I don't have a big experience in web browser control programming, cannot say what data/states are usually shared.
#3
There look like there were problems with the WebBrowser control sharing state:
http://support.microsoft.com/kb/2980020
Doing a windows update does seem to make it marginally more stable but I think there are still some issues. Still digging :-)


Forum Jump:


Users browsing this thread: 1 Guest(s)