Solution EmbeddedWebBrowser website reported "Invalid floating point operation"

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

I have been using EmbeddedWebBrowser to do they use a browser, But found in enter some websites is a browser card dead or collapse, Then view the error found is the basic Flash.ocx Active controls to produce abnormal, Then throw the Invalid floating point operation error, To produce the wrong site basically are some video website, The most typical is Tencent video, For this unusual approach, Never found, Until recently to see the garden Eboy's blog this article

Then find a solution to the problem, in accordance with the above, I am in the main the form's Create event is added in the code:


Compile and run the test problem is still!

It is in this way is the bluff? ? ?

My browser is created dynamically, will be the reason?? I also joined in the above code in browsing creates the event, after the test found that the problem is still, but suddenly think of Google search, so casually, found the:

function Get8087CW: Word; // for D5
        PUSH    0
        FNSTCW  [ESP].Word
        POP     EAX

procedure TForm1.FormCreate(Sender: TObject);
  Timer1.Enabled := False;
  Timer1.Interval := 5000; // 5 sec
  Saved8087CW := Get8087CW;

procedure TForm1.WebBrowser1BeforeNavigate2(Sender: TObject;
  const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
  Headers: OleVariant; var Cancel: WordBool);
  Timer1.Enabled := False;
  System.Set8087CW($133F); // Disable all fpu exceptions

procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
  const pDisp: IDispatch; var URL: OleVariant);
   Timer1.Enabled := True;

procedure TForm1.Timer1Timer(Sender: TObject);
  Timer1.Enabled := False;

The answer, I immediately joined in the WebBrowser WebBrowser1BeforeNavigate2 event.


Not according to that method, magical things happen, this problem was solved.

Looked that, originally was forced to shut down the FPU floating point error

Subsequent tests also indicate that, this kind of close not completely, sometimes throws a Invalid floating point operation anomaly, but the issue has been resolved.!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Derek at January 07, 2014 - 3:54 AM