我已经完成了将Gecko
浏览器组件集成到现有winform控件的任务,但我面临的问题是如何配置dll,我也尝试使用不同的版本,但没有运气,它不加载DLL并给出错误
Unable to find an entry point named 'NS_Alloc' in DLL 'xul'.
我已从指定链接单独下载。 Xulrunner 最新的,也是29,但它说,
An error occurred creating the form. See Exception.InnerException for details. The error is: Unable to load DLL 'xul': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Imports System.IO
导入System.Xml 进口壁虎 导入Microsoft.Win32
Public Class Form1
Public Sub New()
InitializeComponent()
'D:\xulrunner\bin
Xpcom.Initialize("D:\\xulrunner\\") 'xulrunner
'Xpcom.Initialize("C:\Program Files (x86)\Mozilla Firefox\")
End Sub
结束班
如果有人已经做过,请帮助我。
答案 0 :(得分:1)
最后我设法这样做了,
在撰写本文时,我选择了最新版本GeckoFX-33.0和XULRunner 33.1.,
如上所示添加对dll的引用,单击“浏览”并选择 Geckofx-Core.dll和Geckofx-Winforms.dll
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Printing;
namespace GECKO_FORMS
{
public partial class Form1 : Form
{
Bitmap bitmap;
Bitmap memoryImage;
public Form1()
{
InitializeComponent();
Gecko.Xpcom.Initialize(@"D:\\xulrunner\bin\\");
}
private void cmdbrowse_Click(object sender, EventArgs e)
{
try
{
if (browse.IsBusy == false)
{
browse.Navigate(textBox1.Text);
}
else
{
lbox.Items.Add(browse.StatusText);
lbox.Items.Add(browse.History);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void cmdstop_Click(object sender, EventArgs e)
{
browse.Stop();
}
private void browse_ProgressChanged(object sender, Gecko.GeckoProgressEventArgs e)
{
lbox.Items.Add(e.CurrentProgress + " of " + e.MaximumProgress);
}
private void CaptureScreen()
{
Graphics myGraphics = this.CreateGraphics();
Size s = this.Size;
memoryImage = new Bitmap(s.Width, s.Height, myGraphics);
Graphics memoryGraphics = Graphics.FromImage(memoryImage);
memoryGraphics.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, s);
}
private void cmdprint_Click(object sender, EventArgs e)
{
try
{
CaptureScreen();
pDoc.Print();
////Add a Panel control.
//Panel panel = new Panel();
//this.Controls.Add(panel);
////Create a Bitmap of size same as that of the Form.
//Graphics grp = panel.CreateGraphics();
//Size formSize = this.ClientSize;
//bitmap = new Bitmap(formSize.Width, formSize.Height, grp);
//grp = Graphics.FromImage(bitmap);
////Copy screen area that that the Panel covers.
//Point panelLocation = PointToScreen(panel.Location);
//grp.CopyFromScreen(panelLocation.X, panelLocation.Y, 0, 0, formSize);
////Show the Print Preview Dialog.
//ppd.Document = pDoc;
//ppd.PrintPreviewControl.Zoom = 1;
//ppd.ShowDialog();
}
catch (Exception ex)
{
}
}
private void pDoc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawImage(bitmap, 0, 0);
}
}
}