TEventObject and WebBrowser

I created TEventObject to provide OnMouseDown and OnMouseMove events for TWebBrowser . Events work great when moving the mouse and when clicking in a web browser, but when I scroll or select the vertical scroll bar of a web browser a EZeroDivide exception. EurekaLog reports an EZeroDivide exception in the d2d1.dll file. I tried to catch the exception, but nothing I tried seems to work:

 function TEventObject.Invoke( DispID: integer; const IID: TGUID; LocaleID: integer; Flags: Word; var Params; VarResult, ExcepInfo, ArgErr: Pointer ): HResult; begin try if ( DispID = DISPID_VALUE ) then begin if Assigned( FOnEvent ) then FOnEvent; Result := S_OK; end else begin FOnEvent := nil; Result := E_NOTIMPL; end; except on EZeroDivide do begin FOnEvent := nil; Result := E_NOTIMPL; end; end; end; 

My question is: can I prevent the exception in any way, or display mousedown on the TWebbrowser vertical scrollbar to prevent the exception? This exception is difficult for me to solve because I know little about TEventObject, and I don’t understand why this exception occurs only when you click or drag the vertical scrollbar. If necessary, I can provide more information. Compiler: Delphi 2010.

[edit] View this post: http://www.codenewsfast.com/cnf/article/0/waArticleBookmark.7401953 A very simple demo application is available at: http://dl.dropbox.com/u/2167512/bugs/ ie9 / ie9_bug.zip

This prevents the error:

 Math.SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide,exOverflow, exUnderflow, exPrecision]); 
+4
source share
1 answer

try disabling FPU exceptions:

 System.Set8087CW($133F); 

In newer versions of Delphi:

 Math.SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); 
+2
source

Source: https://habr.com/ru/post/1389297/


All Articles