2010-08-24 44 views
1

我開始了一個非常簡單的項目 - 本質上是一個Web瀏覽器,具有硬編碼的URL用於公共終端使用。也就是說,如果C#網絡瀏覽器控件不會讓我想自殺,那麼它會變得很簡單。Skybound壁虎項目:試圖讀取或寫入受保護的內存

我決定去Skybound Gecko瀏覽器,因爲它似乎是唯一可行的選擇..我通過這個項目的一些學習曲線,並且解決了幾個「Starter」錯誤(即無法導航在設置窗口句柄之前,以及找不到xpcom.dll時的錯誤),並且已經糾正它們

現在,當我去運行應用程序並在Skybound Gecko Control中打開URL時,出現錯誤在Program.cs中。

另外,在附註中,我安裝了Stylizer 5,它正確使用了Skybound項目,所以我假設它在我的代碼或配置中。

任何援助將不勝感激。

Program.cs的(其中示出了錯誤)

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Windows.Forms; 

namespace alphaCommKiosk 
{ 
    static class Program 
    { 
     /// <summary> 
     /// The main entry point for the application. 
     /// </summary> 
     [STAThread] 
     static void Main() 
     { 
      Application.EnableVisualStyles(); 
      Application.SetCompatibleTextRenderingDefault(false); 

      //Error Line-------------------------------------------- 
      Application.Run(new Form1()); // <--- ERROR OCCURS HERE. 
     } 
    } 
} 

相關代碼

//webBrowser1 is a control dragged onto the form 
    //Intialize 
    string path = "C:\\Program Files (x86)\\xulrunner\\"; 
    Skybound.Gecko.Xpcom.Initialize(path); 
    webBrowser1 = new Skybound.Gecko.GeckoWebBrowser(); 
    webBrowser1.CreateControl(); 
    string u = "http://www.domaion.com/kiosk/index.php?account=" + mAccount + "&hash=" + mHash; 

    //Navigate 
    webBrowser1.Navigate("http://www.ibm.com/"); 
    //execution actually progresses past this line to the end of the sub 

完整的錯誤和堆棧跟蹤

System.AccessViolationException was unhandled 
    Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt. 
    Source=System.Windows.Forms 
    StackTrace: 
     at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) 
     at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) 
     at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) 
     at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) 
     at System.Windows.Forms.Application.Run(Form mainForm) 
     at alphaCommKiosk.Program.Main() in c:\code\alphaCommKiosk\alphaCommKiosk\Program.cs:line 18 
     at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) 
     at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) 
     at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 
     at System.Threading.ThreadHelper.ThreadStart_Context(Object state) 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
     at System.Threading.ThreadHelper.ThreadStart() 
    InnerException: 

回答

0

我能夠通過切換到WebKit組件來解決這一整天的問題。坦率地說,如果我首先發現了這一點,那麼無論如何,我寧願對FireFox進行「chrome-esque」控制。

http://webkitdotnet.sourceforge.net/downloads.php

超級易於安裝和無的問題在於,的XULrunner垃圾

相關問題