Hack Forums
[.NET] Simple way of getting Firefox current URL - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Simple way of getting Firefox current URL (/showthread.php?tid=3250728)



Simple way of getting Firefox current URL - Networkmancer - Feb 11, 2013

What you need to download: NDde.dll
Next is to Add it as your project reference
Project -> Add Reference -> Browse the dll


TOP MOST
Code
Imports NDde.Client

CALL
Code
VARIABLE = GetBrowserURL("Firefox")
TextBox1.Text = GetBrowserURL("Firefox")

FUNCTION
Code
Private Function GetBrowserURL(browser As String) As String
  Try
    Dim dde As New DdeClient(browser, "WWW_GetWindowInfo")
    dde.Connect()
    Dim url As String = dde.Request("URL", Integer.MaxValue)
    Dim text As String() = url.Split(New String() {""","""}, StringSplitOptions.RemoveEmptyEntries)
    dde.Disconnect()
    Return text(0).Substring(1)
  Catch
    Return Nothing
  End Try
    End Function

Want it to get everytime?
Place it in a timer

Its up to you if where you will store it.
Ill show you a listbox example.

Code
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
  Dim counter As Integer = 0
  For a As Integer = 0 To ListBox1.Items.Count - 1
    If ListBox1.Items(a).ToString() = GetBrowserURL("Firefox") Then
    Exit For
    Else
    counter += 1
    End If
  Next
  If counter = ListBox1.Items.Count Then
    ListBox1.Items.Add(GetBrowserURL("Firefox"))
  End If
    End Sub



* - nathan72389 - Feb 11, 2013

fuck your lame ass adfly bullshit.

direct link to the dll
http://ndde.codeplex.com/


* - Networkmancer - Feb 11, 2013

So thats what I get from sharing the code? Rather than telling people to PM for the source etc. Lame.


* - C3ol - Feb 11, 2013

all
http://social.msdn.microsoft.com/Forums/en/vbgeneral/thread/ca257f22-115e-43f2-a28d-c806c81061b7


* - XvI Beta IvX - Feb 11, 2013

(Feb 11, 2013 11:00 AM)Networkmancer Wrote:  So thats what I get from sharing the code? Rather than telling people to PM for the source etc. Lame.
Trying to make money from something you didn't make, you deserve the flames.


* - Spadassin150 - Feb 11, 2013

What the heck is your problem people, if he choose to put an adfly link then this is entirely up to him, i personally didn't know about the dll thanks to him. Stop making me sick "please"


* - XvI Beta IvX - Feb 11, 2013

(Feb 11, 2013 01:33 PM)Spadassin150 Wrote:  What the heck is your problem people, if he choose to put an adfly link then this is entirely up to him, i personally didn't know about the dll thanks to him. Stop making me sick "please"
So you are basically saying that it's ok for him to advertise and make money off of something he doesn't own and never created? I don't think so.


* - Artisanal - Feb 11, 2013

Nice tutorial, but AdFly is yust ๐Ÿ˜–


* - แ’ชeumonic - Feb 11, 2013

Quote:"This library is only intended to be used when no other alternatives exist."

Hmmm... I don't think I will really be using this..


* - Networkmancer - Feb 11, 2013

(Feb 11, 2013 01:44 PM)XvI Beta IvX Wrote:  So you are basically saying that it's ok for him to advertise and make money off of something he doesn't own and never created? I don't think so.

Did you ever not realized that many here did not create their own software and source code but was making reputation + links like that through PM method. I did not emphasize to download the .dll through my link. I simply stated what you will need so its up to you to google the .dll or to use my link. ๐Ÿ˜‘

(Feb 11, 2013 12:09 PM)C3ol Wrote:  all
http://social.msdn.microsoft.com/Forums/en/vbgeneral/thread/ca257f22-115e-43f2-a28d-c806c81061b7
Never been there. This was actually from a C# code.


* - XvI Beta IvX - Feb 11, 2013

(Feb 11, 2013 04:59 PM)Networkmancer Wrote:  Did you ever not realized that many here did not create their own software and source code but was making reputation + links like that through PM method. I did not emphasize to download the .dll through my link. I simply stated what you will need so its up to you to google the .dll or to use my link. ๐Ÿ˜‘
Yes and the people who do those kind of links and things when the software is not complicated are skids, I could see an amazing program being PM only but this isn't even PM only, It's adfly and you are trying to make some money off of something you didn't make or own...


* - AX5 - Feb 12, 2013

Well i dont minde ppl adding adfly they spend time to post codes and stuff so why not support them with a click and 5 sec of your time. better adfly the survery sites , "cant spell it ^^"


* - Networkmancer - Feb 12, 2013

(Feb 12, 2013 12:36 PM)AX5 Wrote:  Well i dont minde ppl adding adfly they spend time to post codes and stuff so why not support them with a click and 5 sec of your time. better adfly the survery sites , "cant spell it ^^"

Well because their whiners that want to be cool here, but I removed it for them.


* - steny - Feb 13, 2013

In my opinion it is his own choice to put an Adfly Link in it... He posted it. i dint saw any of you do it -.-

Anyway thanks for sharing :-)


* - TraptCode - Feb 13, 2013

Implement a Finally into your Try Catch method. If it connects and an error is thrown, Disconnect won't be called. This can cause a lot of errors.

Also, use ListBox.Items.Contains() rather than enumerating each one.