关于delphi软件运行出现Invalid floating point operation的错误的解决办法

关于delphi软件运行出现Invalid floating point operation的错误的解决办法  

 

 

关于delphi软件运行出现Invalid floating point operation的错误的解决办法
软件如果有webbrowser载入网页的时候经常会出现这个错误。这个错误是webbrowser3个Bug之一。
具体行程的原因大概我也不知道。基本是如果XP系统编译的,放到vista或者V7就容易出现这个错误。具体解决的办法也是很简单的。
查看官方的解决办法如下。
When running floating point code, such as that found in Direct 3D, you will often get a series of floating point exceptions. Microsoft supporesses these exceptions by default, but we raise them. It is easy to turn this option off in both C++Builder and Delphi.

Here is how to turn them off in C++Builder:

#include float.h

__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{
  _control87(MCW_EM, MCW_EM);
}

Here is how to turn them off in Delphi:

  const
  MCW_EM = DWord($133f);
  begin
  Set8087CW(MCW_EM);
  end;

这是官方解决方案,大体的意思就是加上两句代码。具体家在哪里我说明一下。
  const
    MCW_EM = DWord($133f); 这一句是定义的常量,当然是写在定义常量的地方。
    Set8087CW(MCW_EM); 这一句就写在窗体创建的部分就可以了
就这么简单

posted @ 2014-11-21 11:34  老榕树  阅读(9673)  评论(0编辑  收藏  举报