end;
test.html
My application crashes in both methods. I get An unhandled win32 exception (caused by Flash player Exception EInvalidOp in module Flash10u.ocx at 00108657. Invalid floating point operation).
I tried this code on D5, D7, D9.
I tried to re-import SHDocVw.dll.
I also tried to use EmbeddedWB control instead of TWebBroser...
Internet Explorer/Avant/Maxthon has no problems with this HTML (all based on IE ActiveX).
Any suggestions or a fix?
How can I catch this error or even suppress it?
Is there a way to manipulate or change the HTML on the fly via a TWebBrowser event, so I can display an Image instead of the Flash player, same as Ad-Blockers works? (My customers have that code in their sites over the internet, and my Delphi application provides a fast preview)
UPDATE
I used a TTimer to enable/disable FPU (based on Arjen's idea):
解决办法:
function Get8087CW: Word; // for D5
asm
PUSH 0
FNSTCW [ESP].Word
POP EAX
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Timer1.Enabled := False;
Timer1.Interval := 5000; // 5 sec
Saved8087CW := Get8087CW;
end;
procedure TForm1.WebBrowser1BeforeNavigate2(Sender: TObject;
const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
Headers: OleVariant; var Cancel: WordBool);
begin
Timer1.Enabled := False;
System.Set8087CW($133F); // Disable all fpu exceptions
end;
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
begin
Timer1.Enabled := True;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Timer1.Enabled := False;
Set8087CW(Saved8087CW);
end;
Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号
执行时间: 0.043498039245605 seconds