Mozilla Firefox / Gecko Xulrunner in VB.NET (versions 14 and up)-VBForums
Results 1 to 18 of 18

Thread: Mozilla Firefox / Gecko Xulrunner in VB.NET (versions 14 and up)

  1. #1

    Thread Starter
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Cool Mozilla Firefox / Gecko Xulrunner in VB.NET (versions 14 and up)

    Hi there,

    Many people asked me to create a new tutorial for implementing the Gecko Browser in VB.NET. The old tutorial still works fine, but only with the older versions of the dll. If you want to use that for some reason, visit this link

    I created this tutorial presuming that you understand (the basics) how to work with VS.

    Enough talk and show me!

    1) Download the DLL here: https://bitbucket.org/geckofx/geckofx-14.0/downloads
    2) Extract it
    3) Download the Xulrunner (14!) here: http://ftp.mozilla.org/pub/mozilla.o...eases/14.0b12/
    4) Extract the files

    5) Create a new project:





    6) Add "Reference" to your project:





    7) Reference the "geckofx-core-14.dll" (Copy Local : True)





    8) Right-Click your toolbox and add the control "Geckofx-Winforms-14.dll"





    9) Select the control from your toolbox





    10) Drag the control to your form and resize it (what ever you want to do)





    11) Open the Properties of your project and click on "Application" -> "View Application Events"





    12) Copy and replace everything with the following code (only if you never used anything in here)

    vb.net Code:
    1. Imports Gecko
    2. Imports System.IO
    3.  
    4. Namespace My
    5.  
    6.     ' The following events are available for MyApplication:
    7.     '
    8.     ' Startup: Raised when the application starts, before the startup form is created.
    9.     ' Shutdown: Raised after all application forms are closed.  This event is not raised if the application terminates abnormally.
    10.     ' UnhandledException: Raised if the application encounters an unhandled exception.
    11.     ' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
    12.     ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
    13.     Partial Friend Class MyApplication
    14.  
    15.         Protected Overrides Function OnStartup(ByVal eventArgs As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) As Boolean
    16.  
    17.             '   set the path to the temp files
    18.             Dim ProfileDirectory As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\your-appname-companyname-folder\DefaultProfile"
    19.             If Not Directory.Exists(ProfileDirectory) Then
    20.                 Directory.CreateDirectory(ProfileDirectory)
    21.             End If
    22.  
    23.             '   set the temp-directory for the gecko
    24.             Xpcom.ProfileDirectory = ProfileDirectory
    25.  
    26.             '   set the path of the directory where the xulrunner files are located
    27.             Dim xrPath As String = System.Reflection.Assembly.GetExecutingAssembly.Location
    28.             xrPath = xrPath.Substring(0, xrPath.LastIndexOf("\") + 1) & "\xulrunner"
    29.  
    30.             '   initialize the path
    31.             Xpcom.Initialize(xrPath)
    32.             Return True
    33.         End Function
    34.  
    35.     End Class
    36. End Namespace

    13) Drag and Drop the complete "xulrunner" folder to the Solution Explorer.
    14) Select every file (not folder) and set the property to: "Copy if newer"





    15) copy and paste code in your Form_Load(...)... event


    vb.net Code:
    1. GeckoWebBrowser1.Navigate("http://www.x-impress.com")


    16) Run the code and voila




    Remember that I'm only showing you how to implement it. The rest is up to you. Let me know if something is unclear to you.

    Happy coding


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  2. #2
    New Member
    Join Date
    Feb 2013
    Posts
    1

    Thumbs up Re: Mozilla Firefox / Gecko Xulrunner in VB.NET (versions 14 and up)

    Hi Radjesh,

    Very nice tutorial and works perfectly. But, I have stumbled upon another issue.
    I need to use a different instance of the Gecko control, to do some background scrapping/downloading, while the user works with the main thread's control. The problem is that if I use a new thread, via a background worker, the Gecko control is never initialized!
    Seems that xulrunner does not communicate with the new thread or something like that.

    Any ideas?

    Using VB 2010

  3. #3
    Lively Member Amerigo's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    116

    Re: Mozilla Firefox / Gecko Xulrunner in VB.NET (versions 14 and up)

    Thank you for the tutorial. I am trying to create a UserControl. It appears that UserControls don't use Application Events, so View Application Events button is disabled so I can't copy the above code there. Any suggestions?
    I almost forgot, I had added the contents of the Xulrunner folder to the solution explorer and got 102 errors from some of those files when I tried to build the project.
    Anyone who does not wonder, is either omnipotent or a fool.
    Amerigoware <<<My Projects

  4. #4
    New Member
    Join Date
    Jan 2013
    Posts
    2

    Re: Mozilla Firefox / Gecko Xulrunner in VB.NET (versions 14 and up)

    This method works through version 21 (of xulrunner and gecko) but when I tried to install ver. 22 (newest at this writing) - there is a missing dll error (geckofx-core-##.dll I think - but it has been awhile now) that is not included in the packages - but I guess still needed.

    In the end - I got it to run with ver. 21 and gave up.

    Has anyone else conquered version 22 (or higher)>

  5. #5
    Junior Member
    Join Date
    Oct 2013
    Posts
    19

    Re: Mozilla Firefox / Gecko Xulrunner in VB.NET (versions 14 and up)

    Right now I am trying to conquer version 22 but I am using the latest version of xulrunner which I think is around 25. Hopefully it will work.

    Nothing good came out of that. I expected that. But did you try xulrunner 22.0?

    Edit:

    Gecko 22 works like a charm (With XULRunner 22.0). It is a lot faster than previous versions I have tried.
    Last edited by RichardSchneider; Oct 18th, 2013 at 08:10 AM.

  6. #6

    Thread Starter
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: Mozilla Firefox / Gecko Xulrunner in VB.NET (versions 14 and up)

    I work with version 22 atm.


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  7. #7
    New Member
    Join Date
    Jan 2013
    Posts
    2

    Re: Mozilla Firefox / Gecko Xulrunner in VB.NET (versions 14 and up)

    @Richard:
    So, you had no missing dll errors with Gecko 22 and XULRunner 22? Or, was there something sneaky in the install?

  8. #8
    Junior Member
    Join Date
    Oct 2013
    Posts
    19

    Re: Mozilla Firefox / Gecko Xulrunner in VB.NET (versions 14 and up)

    @CptnVic, I have no missing dll errors. There was also no sneaky install. I got the gecko from bitbucket, you can find it here: https://bitbucket.org/geckofx/geckofx-22.0/downloads and it is version 22.0-0.6 it was just updated 3 days ago. Next I got the xulrunner from here: http://ftp.mozilla.org/pub/mozilla.o...22.0/runtimes/
    I got this one: xulrunner-22.0.en-US.win32.zip
    Direct Link for XULRunner:
    http://ftp.mozilla.org/pub/mozilla.o...n-US.win32.zip

    Direct link for gecko:
    https://bitbucket.org/geckofx/geckof...s-22.0-0.6.zip

    Then I just followed his tutorial and it all worked fine.

  9. #9
    Junior Member
    Join Date
    Oct 2013
    Posts
    19

    Re: Mozilla Firefox / Gecko Xulrunner in VB.NET (versions 14 and up)

    Also, @Radjesh Klauke, Can you watch youtube videos using gecko 22? I can get to them but once I am on the page the video is on the video never starts it stays as just a black rectangle on the page, no loading either.

  10. #10
    Addicted Member Miklogak's Avatar
    Join Date
    Jan 2013
    Posts
    181

    Re: Mozilla Firefox / Gecko Xulrunner in VB.NET (versions 14 and up)

    @Radjesh, All the files doesnt exist in the given link.! Secondly the files in the versions online are completely different today even tho the Packages does have the same name.

    And last but not least, you did not explain about this part:
    Dim ProfileDirectory As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\your-appname-companyname-folder\DefaultProfile"

    Which Appname or foldername should I add where it says "your-appname-companyname-folder\DefaultProfile"?

    Very confusing, but else I did it all and thanks for the great tutorial!

    A huge thanks to the Great Devs on vBForums who has been helping others for YEARS, and almost everyday! They make this forum worth visiting over and over again! Special thanks to Dunfiddlin, Paul, TechnoGome, , JayInThe813, ident and those I forgot to mention!

  11. #11
    New Member
    Join Date
    Nov 2013
    Posts
    7

    Re: Mozilla Firefox / Gecko Xulrunner in VB.NET (versions 14 and up)

    How would you actually bundle the whole web browser up into an installer once you're done coding ?

  12. #12

    Thread Starter
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: Mozilla Firefox / Gecko Xulrunner in VB.NET (versions 14 and up)

    Hi Jon. Just the same as you would do another project. You need to include all the files in your build-folder in your installer.


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  13. #13
    New Member
    Join Date
    Nov 2013
    Posts
    1

    Re: Mozilla Firefox / Gecko Xulrunner in VB.NET (versions 14 and up)

    This is a very cool tutorial that run very well for me !

    Does exist sources example how to use these dlls ?

    Thanks

  14. #14
    New Member
    Join Date
    Aug 2013
    Posts
    11

    Re: Mozilla Firefox / Gecko Xulrunner in VB.NET (versions 14 and up)

    Thank you for this really nice tutorial. I tried v22 and it works like a charm. My only question is how do we suppose to handle popups from CreateWindow2 event of this browser?..

  15. #15
    Member
    Join Date
    Aug 2011
    Posts
    46

    Re: Mozilla Firefox / Gecko Xulrunner in VB.NET (versions 14 and up)

    Thanks, you really helped me with my project. I have a question:
    When I load pages, sometimes, my mouse cursor move slowly or just stutters until the whole page is finished loading. How can I fix it?

  16. #16

    Thread Starter
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: Mozilla Firefox / Gecko Xulrunner in VB.NET (versions 14 and up)

    @Zeev. Sorry, can't explain that. Try a newer version from Bitbucket: https://bitbucket.org/repo/all?name=geckofx


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  17. #17
    New Member
    Join Date
    Aug 2013
    Posts
    11

    Re: Mozilla Firefox / Gecko Xulrunner in VB.NET (versions 14 and up)

    What is the most stable version of geckofx?

  18. #18
    New Member
    Join Date
    Apr 2014
    Posts
    1

    stylize Gecko Xulrunner by Firefox addons

    I'm using GeckoFX_28 by VB
    How I can load user.js and extentions???
    I want stylize the webbrowser by AGENT_SHEET, but I cant find how do
    You have any ideas????

    Thank's

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.