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

Re: vb.net 08 Show all visited websites 80 80

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 :)

Re: vb.net 08 Show all visited websites 80 80

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

Re: vb.net 08 Show all visited websites 80 80

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

Re: vb.net 08 Show all visited websites 80 80

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?

Re: vb.net 08 Show all visited websites 80 80

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

Re: vb.net 08 Show all visited websites 80 80

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
Re: vb.net 08 Show all visited websites 80 80

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

Re: vb.net 08 Show all visited websites 80 80

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?

Re: vb.net 08 Show all visited websites 80 80

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\<somenumberhash>\history.dat" although now, I think they store it in an sqlite database (same path), making it that much more complicated to read.

Re: vb.net 08 Show all visited websites 80 80

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?

Re: vb.net 08 Show all visited websites 80 80

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
Re: vb.net 08 Show all visited websites 80 80

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

Re: vb.net 08 Show all visited websites 80 80

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)
Re: vb.net 08 Show all visited websites 80 80

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

Re: vb.net 08 Show all visited websites 80 80

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.

Re: vb.net 08 Show all visited websites 80 80

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
Re: vb.net 08 Show all visited websites 80 80

cool thats sorted it comatose.

Thanks alot.

Re: vb.net 08 Show all visited websites 80 80

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.

Re: vb.net 08 Show all visited websites 80 80

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

Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.