title: TEventObject and WebBrowser
body: <p>I created a <code>TEventObject</code> to provide <code>OnMouseDown</code> and <code>OnMouseMove</code> events for <code>TWebBrowser</code>.  The events work perfectly when moving the mouse and when clicking in the webbrowser, but when I scroll or click the webbrowser's vertical scrollbar a <code>EZeroDivide</code> exception ocurs.  EurekaLog reports a EZeroDivide exception in d2d1.dll.  I tried to trap the exception but nothing I have tried seems to work:</p>
  
  <pre><code>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;
  </code></pre>
  
  <p>My question is can I prevent the exception somehow or can mousedown on the TWebbrowser vertical scrollbar be detected to prevent the exception?  This exception is a difficult one for me to solve because I do not know much about TEventObject and I do not understand why the exception only ocurs when clicking or dragging the vertical scrollbar.  I can provide more infomation if needed.  Compiler: Delphi 2010.</p>
  
  <p><strong>[Edit]</strong>
  See this post:
  <a href="http://www.codenewsfast.com/cnf/article/0/waArticleBookmark.7401953" rel="nofollow">http://www.codenewsfast.com/cnf/article/0/waArticleBookmark.7401953</a>
  A very simple demo app is available at:
   <a href="http://dl.dropbox.com/u/2167512/bugs/ie9/ie9_bug.zip" rel="nofollow">http://dl.dropbox.com/u/2167512/bugs/ie9/ie9_bug.zip</a></p>
  
  <p>This prevents the bug:</p>
  
  <pre><code>Math.SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide,exOverflow, exUnderflow, exPrecision]);
  </code></pre>