954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

vb.net 08 Show all visited websites

Hi all,

I would like to be able to show all the websites visited on a machine.

How would i go about doing this.

Thanks

smelf1
Light Poster
44 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

When I need to get them, I do that

ComboBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend
            ComboBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.AllUrl

I don't know, what done behind the scene, but your question will le me work around this, thanks a lot :)

Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
 

I presume i need to use Imports System.Windows.Forms to get that to work.

I was originally just looking to get the *.html from temp internet then i was thinking about reading them from the registry in vista under
local_user\software\microsoft\internet explorer\typedurls

smelf1
Light Poster
44 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

Play with registry... and I assumed it as Windows-based application.

Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
 

What's interesting here, is that both methods are pretty great..... but neither one of them gets the typed URL's of a browser other than IE. What about getting the history of Firefox.... Opera.... Chrome?

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

i am just using IE as i have IE on the machine i am using vb.net from

smelf1
Light Poster
44 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

I was thinking of trying something along the lines of this

Public Function PopulateUrlList() As List(Of String)
        Dim regKey As String = "Software\Microsoft\Internet Explorer\TypedURLs"
        Dim subKey As RegistryKey = Registry.CurrentUser.OpenSubKey(regKey)
        Dim url As String
        Dim urlList As New List(Of String)()
        Dim counter As Integer = 1
        While True
            Dim sValName As String = "url" + counter.ToString()
            url = DirectCast(subKey.GetValue(sValName), String)
            If DirectCast(url, Object) Is Nothing Then
                Exit While
            End If
            urlList.Add(url)
            counter += 1
        End While
        Return urlList
    End Function
smelf1
Light Poster
44 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

Well, That code works... And Pretty Well.

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

Not that I'm doing a project like this but you questioned about Firefox URL's etc Comatose, would the method to do that be similar but adding those registry locations to the list or would there be something different to do those?

rapture
Posting Whiz in Training
294 posts since Jul 2007
Reputation Points: 155
Solved Threads: 41
 

You would have to do something entirely different. Firefox stores it's URL's in files.... I believe under something like "c:\documents and settings\%username%\Application Data\Mozilla\Firefox\Profiles\\history.dat" although now, I think they store it in an sqlite database (same path), making it that much more complicated to read.

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

right changed a bit so i can now get the urls to populate in a combobox.

Imports System
Imports Microsoft.Win32
Imports System.Windows.Forms

Public Class Form1

    Public Function PopulateUrlList() As List(Of String)
        Dim regKey As String = "Software\Microsoft\Internet Explorer\TypedURLs"
        Dim subKey As RegistryKey = Registry.CurrentUser.OpenSubKey(regKey)
        Dim url As String
        Dim urlList As New List(Of String)()
        Dim counter As Integer = 1
        While True
            Dim sValName As String = "url" + counter.ToString()
            url = DirectCast(subKey.GetValue(sValName), String)
            If DirectCast(url, Object) Is Nothing Then
                Exit While
            End If
            urlList.Add(url)
            ComboBox1.Items.Add(url)
            counter += 1
        End While
        Return urlList
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Call PopulateUrlList()
    End Sub
End Class


Is that code okay or would there be a better way to find viewed websites?

smelf1
Light Poster
44 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

That code is fantastic. The only thing that I would mention about it... is that you are using the function to work with your form. On a small scale project, this is fine (and I've seen it used on large scale projects too), but keep in mind that this defeats the entire purpose of a function. Why even use a function... why not put all that code in the Button1_Click Event? The function is meant to be used to GET the list of URL's.... actually displaying them to the user is a different process... a different concept. So getting the data, and showing the data should not be combined.

Imports System
Imports Microsoft.Win32
Imports System.Windows.Forms

Public Class Form1

    Public Function PopulateUrlList() As List(Of String)
        Dim regKey As String = "Software\Microsoft\Internet Explorer\TypedURLs"
        Dim subKey As RegistryKey = Registry.CurrentUser.OpenSubKey(regKey)
        Dim url As String
        Dim urlList As New List(Of String)()
        Dim counter As Integer = 1
        While True
            Dim sValName As String = "url" + counter.ToString()
            url = DirectCast(subKey.GetValue(sValName), String)
            If DirectCast(url, Object) Is Nothing Then
                Exit While
            End If
            urlList.Add(url)
            counter += 1
        End While
        Return urlList
    End Function

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
     dim urls as new List(of string)()
     dim I as integer
     urls =  PopulateUrlList()

     for  I = 0 to urls.count -1 ' maybe i = 1 to urls.count
            ComboBox1.Items.Add(url)          
     next I
    End Sub
End Class
Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

i am only using it in a small program, but if i try your code i get (collection) a load of times in the combo box. Also it says
ComboBox1.Items.Add(urls)
url is not defined so i assume it meant to be urls

smelf1
Light Poster
44 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 
i am only using it in a small program, but if i try your code i get (collection) a load of times in the combo box. Also it says ComboBox1.Items.Add(urls) url is not defined so i assume it meant to be urls

correct, he used url in the first part and urls in the second, it should probably be

ComboBox1.Items.Add(urls)
rapture
Posting Whiz in Training
294 posts since Jul 2007
Reputation Points: 155
Solved Threads: 41
 

ah yeah i changed it to urls before hand and thats when i get (collection) numerous times in the combo box.

smelf1
Light Poster
44 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

I'm not 10% of the programmer these other guys are, but what I do at this point is insert a breakpoint and step through the code to see where the disconnect is.

rapture
Posting Whiz in Training
294 posts since Jul 2007
Reputation Points: 155
Solved Threads: 41
 

No No, It was faulty code :$:

dim urls as new List(of string)()
dim I as integer
urls =  PopulateUrlList()

for  I = 0 to urls.count -1 ' maybe i = 1 to urls.count
     ComboBox1.Items.Add(urls(i))   ' // oops!
next I
Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

cool thats sorted it comatose.

Thanks alot.

smelf1
Light Poster
44 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 
What's interesting here, is that both methods are pretty great..... but neither one of them gets the typed URL's of a browser other than IE. What about getting the history of Firefox.... Opera.... Chrome?

I know and If you were making your own IE then that would work because the Webbrowser control is basicly IE.

Micheal_2009
Newbie Poster
4 posts since Jun 2009
Reputation Points: 10
Solved Threads: 1
 

Please don't post to threads this old . . .

Thanks!

rapture
Posting Whiz in Training
294 posts since Jul 2007
Reputation Points: 155
Solved Threads: 41
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You