TWebBrowser - Trying to fix the “Invalid floating

2019-08-09 06:32发布

问题:

The TWebBrowser component has an error as described here [IE9] 'Floating point division by zero' occurs with WebBrowser. The solution is to call a procedure that will disable all division by zero exceptions. I am trying to fix this problem without having to call this procedure.

So far, the best idea I had was to disable TWebBrowser scroll bars and try to simulate the same functionality using a TScrollBar. So far, it is working but that is the question:

How can I synchronize the navigation in the TWebBrowser with TScrollBar? I need to intercept scroll messages of TWebBrowser and send them to TScrollBar in order to keep the bar synchronized with the document that is being show. Does anyone knows how to do that?

To be more clear: I need an way of telling TScrollBar what is its position relative to the position of the cursor in the TWebBrowser.

I am using Delphi 2010.

回答1:

I don't believe it is worthwhile to try. The scrolling in IE is going to happen with or without its scroll bars being visible ... using your TScrollbar is apparently going to scroll the browser which in turn is assumedly going to generate the same exact error. I don't know the internals of IE to know where exactly this floating point error surfaces...

Are you after all scroll bars, or just the outer one? What about internal content that is scrolled, such as an embedded frame? Do the other internal scroll bars on a document generate the same error? If they do, then you'll be chasing your tail for quite a while trying to out-do IE on all it's scrollable content.

The fix is provided, and tested. Sorry, but I'd use the suggested fix.