我是新来的,希望在C语言中对geckoFX有所帮助#
所以我下载了geckoFX,并做了以下操作。
-
下载:geckofx.dll
-
下载:XULRunner
我成功地添加了geckofx浏览器,工作正常,但当我尝试运行此代码将JavaScript添加到页面时,我收到了一个错误。
我得到的错误是:skybound.geckoFX.AutoJSContext不包含求值脚本和jscontext的定义。
此外,我不知道这是否有帮助,但AutoJSContext和EvaluateScript并不突出。
这是我的代码
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using Skybound.Gecko;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Skybound.Gecko.Xpcom.Initialize(@"C:\Program Files\xulrunner");
}
private void geckoWebBrowser1_DocumentCompleted(object sender, EventArgs e)
{
string outString = "";
using (AutoJSContext java = new AutoJSContext(geckoWebBrowser1.Window.JSContext))
{
java.EvaluateScript(@"window.alert('alert')", out outString);
}
}
}