德尔福XE2,TWebBrowser,浮除零 [英] Delphi XE2, TWebBrowser, float divide by zero

查看:287
本文介绍了德尔福XE2,TWebBrowser,浮除零的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在德尔福2010年和德尔福2007年我使用Set8087CW上WebBrowserBeforeNavigate / WebBrowserDocumentComplete至prevent FPU错误,里面的ActiveX削弱我的应用程序。

In Delphi 2010 and Delphi 2007 I am using Set8087CW on WebBrowserBeforeNavigate / WebBrowserDocumentComplete to prevent FPU errors inside ActiveX to cripple my application.

但不知何故,这是不工作的德尔福XE2,至少当在64位模式。

But somehow this is not working in Delphi XE2, at least when in 64bit mode.

当点击链接(任何)我得到浮动除以零。 (的网站地址或内容到TWebBrowser初始加载工作正常。)

When clicking links (any) I get "float divide by zero". (The initial loading of a website address or content into TWebBrowser works fine.)

调用堆栈显示这种情况发生内部SYSTEM32 \ D3D10Warp.dll(也许使用IE9?)响应于TApplication.ProcessMessage(和一些???其间两个)

The callstack shows this to happen inside system32\D3D10Warp.dll (maybe used by IE9?) in response to TApplication.ProcessMessage (and some ??? inbetween the two)

推荐答案

您需要掩盖SSE例外在64位,因为64位code通常使用SSE执行浮点运算。

You will need to mask SSE exceptions on 64 bit because 64 bit code typically uses SSE to perform floating point arithmetic.

呼叫 SetMXCSR 以改变上证所单元的控制状态。个人而言,我会继续屏蔽,因为64位code 8087的例外是完全可以自由使用8087单位应当会这样的愿望。要调用的Web浏览器code时使用的魔法MXCSR值为 $ 1F80 。这是Windows的默认值MXCSR。

Call SetMXCSR to change the control state of the SSE unit. Personally I would continue masking 8087 exceptions since 64 bit code is perfectly at liberty to use the 8087 unit should it so wish. The magic MXCSR value that you want to use when calling the web browser code is $1F80. This is the default Windows value for MXCSR.

另外,你可以调用<一个href="http://docwiki.embarcadero.com/VCL/en/Math.SetSSEExceptionMask"><$c$c>SetSSEExceptionMask和<一href="http://docwiki.embarcadero.com/VCL/en/Math.SetFPUExceptionMask"><$c$c>SetFPUExceptionMask通过 exAllArithmeticExceptions 来屏蔽所有的异常。这些方便的方法将使你的code更具可读性。

Alternatively, you can call SetSSEExceptionMask and SetFPUExceptionMask passing exAllArithmeticExceptions to mask all exceptions. These convenience methods would make your code more readable.

如果你感到满意的是,你只需要在x86和上证所在x64掩盖在8087例外,那么你可以叫<一href="http://docwiki.embarcadero.com/VCL/en/Math.SetExceptionMask"><$c$c>SetExceptionMask.这将改变8087控制状态下的x86和改变在x64上证控制状态。

If you are satisfied that you only need to mask exceptions on 8087 under x86 and SSE under x64 then you can just call SetExceptionMask. This will change the 8087 control state under x86 and change the SSE control state under x64.

如果我有设置整个控制状态,或者使用的方便的方法来改变只是例外屏蔽状态的一部分之间做出选择,我会设置整个控制状态。这些ActiveX控件,您将使用MS工具和期望的特定FP控制状态的假设下写的。我想给这些控件,他们希望精确的控制状态,然后返回到德尔福控制状态时,执行返回的控制。

If I had to choose between setting the entire control state or using the convenience methods to change just the exception masking part of the state, I would set the entire control state. These ActiveX controls are written under the assumption that you will be using MS tooling and expect a specific FP control state. I would give these controls the exact control state that they expect and then revert back to the Delphi control state when execution returns from the controls.

这篇关于德尔福XE2,TWebBrowser,浮除零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆