使用Delphi程序的Java脚本

时间:2013-06-18 12:56:02

标签: javascript delphi delphi-7

如何使用带有WebBrowser的Delphi程序的googiespell脚本。脚本用于拼写检查。我的代码是在Webbrowser中使用java脚本。

这是执行脚本的代码。

uses
  MSHTML_TLB, SHDocVw, ShellAPI;

function ExecuteScript(doc: IHTMLDocument2; script: string; language: string): Boolean;
var
  win: IHTMLWindow2;
  Olelanguage: Olevariant;
begin
  if doc <> nil then
  begin
    try
      win := doc.parentWindow;
      if win <> nil then
      begin
        try
          Olelanguage := language;
          win.ExecScript(script, Olelanguage);
        finally
          win := nil;
        end;
      end;
    finally
      doc := nil;
    end;
  end;
end;


Sample usage:

IDoc: IHTMLDocument2;
Webbrowser1.Document.QueryInterface(IHTMLDocument2, iDoc);
ExecuteScript(iDoc, 'document.login.submit()', 'JavaScript'); 

所以我需要使用googiespell脚本来使用webbrowser进行拼写检查。请帮帮我。?

您可以从this网站

下载googiespell脚本

0 个答案:

没有答案