Mi è stato assegnato un compito di integrazione Gecko
componente del browser a un controllo della forma attuale esistente,ma il problema che sto affrontando è come configurare dll, sto provando anche con una versione diversa, ma senza fortuna, a questo punto non carica dll e dà l'errore
Unable to find an entry point named "NS_Alloc" in DLL "xul".
Ho scaricato separatamente dal link indicato. XULRunner l'ultimo e anche il 29 ma dice,
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
Importa System.Xml Importa Gecko Importa Microsoft.Win32
Classe pubblica Form1
Public Sub New()
InitializeComponent()
"D:xulrunnerbin
Xpcom.Initialize("D:\xulrunner\") "xulrunner
"Xpcom.Initialize("C:Program Files (x86)Mozilla Firefox")
End Sub
End Class
per favore aiutatemi se qualcuno ha già finito con quello.
risposte:
1 per risposta № 1Finalmente sono riuscito a farlo,
Al momento della scrittura, scelgo l'ultima versione GeckoFX-33.0, e XULRunner 33.1. ,
- Disimballare GeckoFX-330.zip, otterrai i seguenti file:
Aggiungi riferimenti alle DLL come mostrato sopra, fai clic su Sfoglia e seleziona il Geckofx-Core.dll e Geckofx-Winforms.dll
- Nella casella degli strumenti, fare clic con il tasto destro, quindi selezionare "Scegli elemento", selezionare Geckofx-Winforms.dll e verrà mostrato il controllo del winform di Gecko la cassetta degli attrezzi
- Trascina un controllo GeckoWebBrowser nel designer di winform e andiamo chiamalo "sfoglia"
Nel file form1.cs, aggiungi sotto il codice: E INFINE CODICE:
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:\xulrunnerbin\"); } 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); } } }