關於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); 這一句就寫在窗體創建的部分就可以了
就這麼簡單

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章