事件没有被解雇
Event is not getting fired
我正在尝试使用 TWebbrowser
中的 WebWorkerStarted
和 WebWorkerFinished
,但是这些事件根本没有被触发。
我怎样才能使这些活动正常进行?我想查看从 TWebbrowser
.
启动了哪些工作线程
unit Unit2;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.OleCtrls, SHDocVw;
type
TForm2 = class(TForm)
WebBrowser1: TWebBrowser;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure WebBrowser1WebWorkerFinsihed(ASender: TObject; dwUniqueID: Cardinal);
procedure WebBrowser1WebWorkerStarted(ASender: TObject; dwUniqueID: Cardinal; const bstrWorkerLabel: WideString);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin
WebBrowser1.Navigate('www.whosebug.com');
end;
procedure TForm2.WebBrowser1WebWorkerFinsihed(ASender: TObject; dwUniqueID: Cardinal);
begin
// does not fire
end;
procedure TForm2.WebBrowser1WebWorkerStarted(ASender: TObject; dwUniqueID: Cardinal; const bstrWorkerLabel: WideString);
begin
// does not fire
end;
end.
如文档所述here :
By default, TWebBrowser uses IE7 Standards mode even if the run-time environment installed the latest IE (for example, IE11).
WebWorkers 是在 IE10 中引入的,因此您必须在更新的模式下安装 IE 运行ning。至少需要设置两个注册表项(如果同时支持 32/64 位则更多):
HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)
{\Wow6432Node}
\SOFTWARE
\Microsoft
\Internet Explorer
\Main
\FeatureControl
\FEATURE_BEHAVIORS
{NEW DWORD -> 'YourApplication.exe'
{ VALUE -> 1
还有(比如IE11模式)
HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)
{\Wow6432Node}
\SOFTWARE
\Microsoft
\Internet Explorer
\Main
\FeatureControl
\FEATURE_BROWSER_EMULATION
{NEW DWORD -> 'YourApplication.exe'
{ VALUE -> 0x2AF8
这将导致由 TWebBrowser 包装的 Internet Explorer 实例在 IE11 模式下 运行,支持 WebWorkers 等。在设置此值之前,您可能应该对已安装的 IE 版本进行某种完整性检查。有关有效条目的更多信息 can be found on MSDN.
导航到 Whosebug 时,这仍然不会为我引发任何 WebWorker
事件(您确定它使用它们吗?)。作为验证测试,此 WebWorkers 演示页面确实引发了 OnWebWorkerStarted
事件:
WebBrowser1.Navigate('https://whatwg.org/demos/workers/primes/page.html');
我正在尝试使用 TWebbrowser
中的 WebWorkerStarted
和 WebWorkerFinished
,但是这些事件根本没有被触发。
我怎样才能使这些活动正常进行?我想查看从 TWebbrowser
.
unit Unit2;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.OleCtrls, SHDocVw;
type
TForm2 = class(TForm)
WebBrowser1: TWebBrowser;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure WebBrowser1WebWorkerFinsihed(ASender: TObject; dwUniqueID: Cardinal);
procedure WebBrowser1WebWorkerStarted(ASender: TObject; dwUniqueID: Cardinal; const bstrWorkerLabel: WideString);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin
WebBrowser1.Navigate('www.whosebug.com');
end;
procedure TForm2.WebBrowser1WebWorkerFinsihed(ASender: TObject; dwUniqueID: Cardinal);
begin
// does not fire
end;
procedure TForm2.WebBrowser1WebWorkerStarted(ASender: TObject; dwUniqueID: Cardinal; const bstrWorkerLabel: WideString);
begin
// does not fire
end;
end.
如文档所述here :
By default, TWebBrowser uses IE7 Standards mode even if the run-time environment installed the latest IE (for example, IE11).
WebWorkers 是在 IE10 中引入的,因此您必须在更新的模式下安装 IE 运行ning。至少需要设置两个注册表项(如果同时支持 32/64 位则更多):
HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)
{\Wow6432Node}
\SOFTWARE
\Microsoft
\Internet Explorer
\Main
\FeatureControl
\FEATURE_BEHAVIORS
{NEW DWORD -> 'YourApplication.exe'
{ VALUE -> 1
还有(比如IE11模式)
HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)
{\Wow6432Node}
\SOFTWARE
\Microsoft
\Internet Explorer
\Main
\FeatureControl
\FEATURE_BROWSER_EMULATION
{NEW DWORD -> 'YourApplication.exe'
{ VALUE -> 0x2AF8
这将导致由 TWebBrowser 包装的 Internet Explorer 实例在 IE11 模式下 运行,支持 WebWorkers 等。在设置此值之前,您可能应该对已安装的 IE 版本进行某种完整性检查。有关有效条目的更多信息 can be found on MSDN.
导航到 Whosebug 时,这仍然不会为我引发任何 WebWorker
事件(您确定它使用它们吗?)。作为验证测试,此 WebWorkers 演示页面确实引发了 OnWebWorkerStarted
事件:
WebBrowser1.Navigate('https://whatwg.org/demos/workers/primes/page.html');